diff --git a/plugin/autoexec.smx b/plugin/autoexec.smx index df92512..0eaac5b 100644 Binary files a/plugin/autoexec.smx and b/plugin/autoexec.smx differ diff --git a/plugin/autoexec.sp b/plugin/autoexec.sp index 693ced8..1386178 100644 --- a/plugin/autoexec.sp +++ b/plugin/autoexec.sp @@ -17,7 +17,9 @@ new StringMap:mapTypeMap; new StringMap:gameModeMap; new StringMap:configOverwriteMap; bool inAutoExec = false; -bool warned[4] = {false, false, false, false}; // size 4 so we can use team indexes + +// size 4 so we can use team indexes +bool warned[4] = {false, false, false, false}; new Handle:CvarLeague = INVALID_HANDLE; new Handle:CvarMode = INVALID_HANDLE; @@ -238,8 +240,8 @@ public Action clearInAutoExec(Handle timer) { } public void OnReadyUp(Event event, const String:name[], bool:dontBroadcast) { - bool redReady = GameRules_GetProp("m_bTeamReady", 1, .element = 2) != 0; - bool blueReady = GameRules_GetProp("m_bTeamReady", 1, .element = 3) != 0; + bool redReady = IsReady(2); + bool blueReady = IsReady(3); CheckWhitelist(); @@ -272,6 +274,7 @@ public void CheckPlayerCount(int team) { PrintToChatAll("Switching config to %s", expectedMode); SetConVarString(CvarMode, expectedMode); ExecMapCfg(); + CreateTimer(0.5, ReadyTeamTimer, team); return; } } @@ -281,13 +284,29 @@ public void CheckPlayerCount(int team) { warned[team] = true; PrintToChatAll("Warning, config is set to %s but you readied up with %d players", gameMode, playerCount); - GameRules_SetProp("m_bTeamReady", 0, _ , team, true); + UnReadyTeam(team); } else { warned[team] = true; } } } +public bool IsReady(int team) { + return GameRules_GetProp("m_bTeamReady", 1, .element = team) != 0; +} + +public void ReadyTeamTimer(Handle _timer, int team) { + ReadyTeam(team); +} + +public void ReadyTeam(int team) { + GameRules_SetProp("m_bTeamReady", 1, _ , team, true); +} + +public void UnReadyTeam(int team) { + GameRules_SetProp("m_bTeamReady", 0, _ , team, true); +} + public void CheckWhitelist() { decl String:whitelist[128]; GetConVarString(CvarWhitelist, whitelist, sizeof(whitelist));