diff --git a/addons/sourcemod/scripting/jwp/mg/events.sp b/addons/sourcemod/scripting/jwp/mg/events.sp index 892a436..90554f7 100644 --- a/addons/sourcemod/scripting/jwp/mg/events.sp +++ b/addons/sourcemod/scripting/jwp/mg/events.sp @@ -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++; @@ -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]) @@ -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) @@ -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; @@ -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); @@ -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) diff --git a/addons/sourcemod/scripting/jwp/mg/games/chickenhunt.sp b/addons/sourcemod/scripting/jwp/mg/games/chickenhunt.sp index f3b342d..a3be6f0 100644 --- a/addons/sourcemod/scripting/jwp/mg/games/chickenhunt.sp +++ b/addons/sourcemod/scripting/jwp/mg/games/chickenhunt.sp @@ -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; @@ -62,9 +67,10 @@ void ProcessChickenHunt() } } } - - + g_hTerTimer = CreateTimer(1.0, Timer_ProcessChickenHuntStart, _, TIMER_REPEAT); + + return Plugin_Stop; } public Action Timer_ProcessChickenHuntStart(Handle timer) diff --git a/addons/sourcemod/scripting/jwp/mg/games/zombie.sp b/addons/sourcemod/scripting/jwp/mg/games/zombie.sp index 331ba9a..6cf0738 100644 --- a/addons/sourcemod/scripting/jwp/mg/games/zombie.sp +++ b/addons/sourcemod/scripting/jwp/mg/games/zombie.sp @@ -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); } @@ -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) @@ -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) { @@ -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); diff --git a/addons/sourcemod/scripting/jwp_mg.sp b/addons/sourcemod/scripting/jwp_mg.sp index dd1a486..1c46e49 100644 --- a/addons/sourcemod/scripting/jwp_mg.sp +++ b/addons/sourcemod/scripting/jwp_mg.sp @@ -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]; @@ -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) { @@ -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);