Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 32 additions & 14 deletions addons/sourcemod/scripting/jwp/mg/events.sp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public void OnClientDisconnect(int client)

public void Event_OnRoundStart(Event event, const char[] name, bool silent)
{
g_iLastGame = -1;

if (g_iCoolDown != 0)
{
if (g_bGamePassed) g_iCoolDownCounter++;
Expand Down Expand Up @@ -109,18 +111,9 @@ public void Event_OnRoundStart(Event event, const char[] name, bool silent)

PrintToChatAll("%s", g_cGameRules); // Print rules to all chat

if (g_iGameMode == zombiemod)
ProcessZombie();
else if (g_iGameMode == hidenseek)
ProcessHidenSeek();
else if (g_iGameMode == chickenhunt)
ProcessChickenHunt();
else if (g_iGameMode == zeusdm)
ProcessZeusDm();
else if (g_iGameMode == hotpotato)
ProcessHotPotato();
else if (g_iGameMode == catchnfree)
ProcessCatchnFree();
RequestFrame(StartGames);

//CreateTimer(3.0, timer_handle);

g_KvConfig.GetString("musicAll", g_cMusicAll, sizeof(g_cMusicAll), "");
if (g_cMusicAll[0] != NULL_STRING[0])
Expand Down Expand Up @@ -151,6 +144,30 @@ public void Event_OnRoundStart(Event event, const char[] name, bool silent)
}
}

/*
Action timer_handle(Handle hTimer, any data)
{
StartGames();
return Plugin_Stop;
}
*/

void StartGames()
{
if (g_iGameMode == zombiemod)
ProcessZombie();
else if (g_iGameMode == hidenseek)
ProcessHidenSeek();
else if (g_iGameMode == chickenhunt)
ProcessChickenHunt();
else if (g_iGameMode == zeusdm)
ProcessZeusDm();
else if (g_iGameMode == hotpotato)
ProcessHotPotato();
else if (g_iGameMode == catchnfree)
ProcessCatchnFree();
}

public void Event_OnRoundEnd(Event event, const char[] name, bool silent)
{
if (g_hTerTimer != null)
Expand Down Expand Up @@ -197,6 +214,7 @@ public void Event_OnRoundEnd(Event event, const char[] name, bool silent)
else if (g_iGameMode == catchnfree)
g_CvarTeammatesEnemies.SetBool(false, true, false);

g_iLastGame = g_iGameMode;
g_iGameMode = -1;
g_bIsGameRunning = false;

Expand Down Expand Up @@ -295,7 +313,7 @@ public Action Event_OnPlayerDeath(Event event, const char[] name, bool silent)
CS_TerminateRound(1.0, CSRoundEnd_TerroristWin);
}
}
else if (g_iGameMode == hidenseek)
else if (g_iGameMode == hidenseek || g_iLastGame == hidenseek)
{
TiB_SetThirdPerson(client, false);

Expand Down Expand Up @@ -440,7 +458,7 @@ public Action Missed(Handle timer, Handle datapack)
int client = ReadPackCell(datapack);
missTimer[client] = null; // clear timer handle

int userid = ReadPackCell(datapack);
//int userid = ReadPackCell(datapack);
if (!IsValidClient(client, _, false)) // Not in game anymore or dead
return;
if (g_iGameMode == hidenseek)
Expand Down
10 changes: 8 additions & 2 deletions addons/sourcemod/scripting/jwp/mg/games/chickenhunt.sp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ char gHunter_Model[PLATFORM_MAX_PATH];
char gHunter_ModelArms[PLATFORM_MAX_PATH];

void ProcessChickenHunt()
{
CreateTimer(3.0, Timer_ProcessChickenHuntDelay);
}

public Action Timer_ProcessChickenHuntDelay(Handle hTimer)
{
if (g_iWaitTimerT < 10)
g_iWaitTimerT = 10;
Expand Down Expand Up @@ -62,9 +67,10 @@ void ProcessChickenHunt()
}
}
}



g_hTerTimer = CreateTimer(1.0, Timer_ProcessChickenHuntStart, _, TIMER_REPEAT);

return Plugin_Stop;
}

public Action Timer_ProcessChickenHuntStart(Handle timer)
Expand Down
17 changes: 11 additions & 6 deletions addons/sourcemod/scripting/jwp/mg/games/zombie.sp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ void ProcessZombie()
gZombie_Health = 5000;

g_KvConfig.GetString("ZombieSkin", gZombie_Model, sizeof(gZombie_Model), "");
if (FileExists(gZombie_Model))
if (gZombie_Model[0] && FileExists(gZombie_Model, true))
PrecacheModel(gZombie_Model);
if(g_bIsCSGO)
{
g_KvConfig.GetString("ZombieArms", gZombie_ModelArms, sizeof(gZombie_ModelArms), "");
if (FileExists(gZombie_ModelArms))
if (gZombie_ModelArms[0] && FileExists(gZombie_ModelArms, true))
PrecacheModel(gZombie_ModelArms);
}

Expand Down Expand Up @@ -76,7 +76,7 @@ public Action Timer_ProcessZombieStart(Handle timer)
{
randomCL = JWP_GetRandomTeamClient(CS_TEAM_T, true);
if (randomCL != -1)
InfectPlayer(randomCL);
RequestFrame(InfectPlayerNextFrame, randomCL); //InfectPlayer(randomCL);
}

for (int i = 1; i <= MaxClients; ++i)
Expand Down Expand Up @@ -142,7 +142,12 @@ public Action ZombieGlobalTimer_Callback(Handle timer)

g_hCtTimer = null;
return Plugin_Stop;
}
}

void InfectPlayerNextFrame(int iClient)
{
InfectPlayer(iClient);
}

void InfectPlayer(int client, bool first_infection = true)
{
Expand All @@ -161,10 +166,10 @@ void InfectPlayer(int client, bool first_infection = true)
GiveWpn(client, "weapon_knife");
SetEntityHealth(client, gZombie_Health);

if (FileExists(gZombie_Model) && IsModelPrecached(gZombie_Model))
if (gZombie_Model[0] && FileExists(gZombie_Model, true) && IsModelPrecached(gZombie_Model))
SetEntityModel(client, gZombie_Model);
if(g_bIsCSGO)
if (FileExists(gZombie_ModelArms) && IsModelPrecached(gZombie_ModelArms))
if (gZombie_ModelArms[0] && FileExists(gZombie_ModelArms, true) && IsModelPrecached(gZombie_ModelArms))
SetEntPropString(client, Prop_Send, "m_szArmsModel", gZombie_ModelArms);
CS_SwitchTeam(client, CS_TEAM_T);

Expand Down
9 changes: 8 additions & 1 deletion addons/sourcemod/scripting/jwp_mg.sp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

bool g_bIsCSGO;

int g_iGameMode = -1, g_iGameId = -1;
int g_iGameMode = -1, g_iGameId = -1, g_iLastGame;
bool g_bIsGameRunning = false;

char g_cGameName[32], g_cGameRules[192], g_cMusicAll[PLATFORM_MAX_PATH];
Expand Down Expand Up @@ -90,6 +90,8 @@ public void OnPluginStart()
RegConsoleCmd("sm_mask", Command_Mask, "Pick up model for hidenseek");
RegConsoleCmd("sm_whistle", Command_Whistle, "Whistle for hidenseek or chickenhunt");
RegConsoleCmd("sm_lr", Listener_LRCommand); // AddCommandListener not block this command

RegConsoleCmd("sm_mg_debug", cmd_hss);

for (int i = 1; i <= MaxClients; ++i)
{
Expand All @@ -100,6 +102,11 @@ public void OnPluginStart()
if (JWP_IsStarted()) JWP_Started();
}

public Action cmd_hss (int iClient, int iArgs)
{
PrintToChatAll("g_iGameMode = %i, g_iGameId = %i;", g_iGameMode, g_iGameId);
}

public APLRes AskPluginLoad2(Handle hMyself, bool bLate, char[] sError, int iErr_max)
{
g_fwdMiniGameStart = CreateGlobalForward("JWP_MG_GameStart", ET_Ignore, Param_Cell);
Expand Down