From 165322e19b394cfb9aee08e2310a50f1eb67fe78 Mon Sep 17 00:00:00 2001 From: SirPlease Date: Tue, 2 Apr 2024 17:38:16 +0200 Subject: [PATCH 1/2] Update autopause This update closes both #745 and #754 - Implemented auto-unpause suggestion by @StarterX4 with some slightly modified logic which I hope they approve of (wait for all crashers to reconnect before unpausing) - Fixed an oversight that could cause an autopause when a spectator crashed (by @altair-sossai ) - Updated Syntax. - Updated Debugging. - Removed some unnecessary code. - Prevented Autopause when the crashed player was a Dead Survivor. --- .../sourcemod/plugins/optional/autopause.smx | Bin 10368 -> 11998 bytes addons/sourcemod/scripting/autopause.sp | 370 ++++++++++++------ 2 files changed, 257 insertions(+), 113 deletions(-) diff --git a/addons/sourcemod/plugins/optional/autopause.smx b/addons/sourcemod/plugins/optional/autopause.smx index df39788d5676bd25847b629c2aedba8c5d803604..b87c755d82e40992ff591d463eceee57afc6c188 100644 GIT binary patch literal 11998 zcmXw~4FVQ>EiRisgqD2p)3!@W;(L3)v z&-;7+*k^z4zTf$tJ@=k<);eolMMZ5rbTqUT9ss~40{|et0{{R&(NM$xGE5!-z(R4P zA^;G}3;^Jvn8XDDXhmgGRE(k+fYQ_b!>#}T9F^Hn@y!hYFv0-gLgh26Ukm^MhGNTP0018o)tjw{ojriZ z&IW7);Cbis))i#y{V(|1c%i`E1`P7G{}6&M%KqDgWJpKYyXR&NIC?7;8Fg7 znT<&aLR%7@Qa&xF6nOMqd0K37V4c0_64Bboz@q^gPVX1iR92_G$z&DOd7A^z5^U{f zcZ*{3^VG0S`i#{g%F=P4`~L9#QMZVIR*|p8ts4KT-}dtR@%!Kjsmr|E!;T}_mQsV! z8KIjQbPhCIs>dH8T4>vVw;@Fqe^?KtesK3kJQt{Gseo&F8{M@B%u5<?bzv^=1@I#4ur%3I|=A56aI5U$@Y6Y;Qtz;lzabp{<&NO38!$Ztv^tQq@fcE4W{>6dG{7i$)%_FjFzEe5+xJpz;HVLPN9T(8`k zvG%HUmS>{JUVLu6#JGtmo|eD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?$QpadcG3NR2xptOb(i4t(nA(n}ld9j7_o+%`*L~>rw$z zlm?tfv_u>r>NU#7^4u@nndWcv?1SrAowNC(?^`Q4gi-eTWruJsD!dA#?p@3gsSDCE z&dt&ml?i?rOhVyx1N;_ zs!GRFM%Q?)E3`zeTRW+{Qt@lFv5bC+7|o{TTr_kMxpfpDZE%`3_wXap*u$QY_-*Nw z=q&|;vD4_+lGX*hx~X5{;A_kTLrMi%3*2-Md9#o0#9B3tQ`$9ju5Z9!`3b}X{|_uR BD5(Gd diff --git a/addons/sourcemod/scripting/autopause.sp b/addons/sourcemod/scripting/autopause.sp index 8d0a71b39..27c8bcff1 100644 --- a/addons/sourcemod/scripting/autopause.sp +++ b/addons/sourcemod/scripting/autopause.sp @@ -1,173 +1,317 @@ /* - SourcePawn is Copyright (C) 2006-2015 AlliedModders LLC. All rights reserved. - SourceMod is Copyright (C) 2006-2015 AlliedModders LLC. All rights reserved. - Pawn and SMALL are Copyright (C) 1997-2015 ITB CompuPhase. - Source is Copyright (C) Valve Corporation. - All trademarks are property of their respective owners. - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see . + SourcePawn is Copyright (C) 2006-2015 AlliedModders LLC. All rights reserved. + SourceMod is Copyright (C) 2006-2015 AlliedModders LLC. All rights reserved. + Pawn and SMALL are Copyright (C) 1997-2015 ITB CompuPhase. + Source is Copyright (C) Valve Corporation. + All trademarks are property of their respective owners. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see . */ + +#pragma newdecls required + #include #include #include #undef REQUIRE_PLUGIN -#include "readyup" +#include +#include + +#define DEBUG_SM 1 +#define DEBUG_CHAT 2 -public Plugin:myinfo = +char sDebugMessage[256]; + +public Plugin myinfo = { name = "L4D2 Auto-pause", - author = "Darkid, Griffin", + author = "Darkid, Griffin, StarterX4", description = "When a player disconnects due to crash, automatically pause the game. When they rejoin, give them a correct spawn timer.", - version = "2.0", - url = "https://github.com/jbzdarkid/AutoPause" + version = "2.2", + url = "https://github.com/SirPlease/L4D2-Competitive-Rework" } -new Handle:g_hCvarEnabled; -new Handle:g_hCvarForce; -new Handle:g_hCvarApdebug; +ConVar + convarEnabled, + convarForce, + convarForceUnpause, + convarDebug; + +Handle + crashedPlayers, + generalCrashers, + infectedPlayers, + survivorPlayers; -new Handle:crashedPlayers; -new Handle:infectedPlayers; -new Handle:survivorPlayers; -new bool:readyUpIsAvailable; -new bool:RoundEnd; +bool + bReadyUpIsAvailable, + bPauseIsAvailable, + bRoundEnd; -public OnPluginStart() { - // Suggestion by Nati: Disable for any 1v1 - g_hCvarEnabled = CreateConVar("autopause_enable", "1", "Whether or not to automatically pause when a player crashes."); - g_hCvarForce = CreateConVar("autopause_force", "0", "Whether or not to force pause when a player crashes."); - g_hCvarApdebug = CreateConVar("autopause_apdebug", "0", "Whether or not to debug information."); +public void OnPluginStart() +{ + convarEnabled = CreateConVar("autopause_enable", "1", "Whether or not to automatically pause when a player crashes."); + convarForce = CreateConVar("autopause_force", "0", "Whether or not to force pause when a player crashes."); + convarForceUnpause = CreateConVar("autopause_forceunpause", "0", "Whether or not we force unpause when the crashed players have loaded back in"); + convarDebug = CreateConVar("autopause_apdebug", "0", "0: No Debugging - 1: Sourcemod Logs - 2: PrintToChat - 3: Both", _, true, 0.0, true, 3.0); crashedPlayers = CreateTrie(); + generalCrashers = CreateArray(64); infectedPlayers = CreateArray(64); survivorPlayers = CreateArray(64); - HookEvent("round_start", round_start); - HookEvent("round_end", round_end); - HookEvent("player_team", playerTeam); - HookEvent("player_disconnect", playerDisconnect, EventHookMode_Pre); + HookEvent("round_start", Event_RoundStart); + HookEvent("round_end", Event_RoundEnd); + HookEvent("player_team", Event_PlayerTeam); + HookEvent("player_disconnect", Event_PlayerDisconnect, EventHookMode_Pre); } -public OnAllPluginsLoaded() +public void OnAllPluginsLoaded() { - readyUpIsAvailable = LibraryExists("readyup"); + bReadyUpIsAvailable = LibraryExists("readyup"); + bPauseIsAvailable = LibraryExists("pause"); } -public OnLibraryRemoved(const String:name[]) +public void OnLibraryRemoved(const char[] name) { - if (StrEqual(name, "readyup")) readyUpIsAvailable = false; + if (strcmp(name, "readyup") == 0) + bReadyUpIsAvailable = false; + + if (strcmp(name, "pause") == 0) + bPauseIsAvailable = false; } -public OnLibraryAdded(const String:name[]) +public void OnLibraryAdded(const char[] name) { - if (StrEqual(name, "readyup")) readyUpIsAvailable = true; + if (strcmp(name, "readyup") == 0) + bReadyUpIsAvailable = true; + + if (strcmp(name, "pause") == 0) + bPauseIsAvailable = true; } -public round_start(Handle:event, const String:name[], bool:dontBroadcast) { +public void OnClientPutInServer(int client) +{ + char sAuthId[64]; + GetClientAuthId(client, AuthId_Steam2, sAuthId, sizeof(sAuthId)); + + if (strcmp(sAuthId, "BOT") == 0) + return; + + int crasherIndex = FindStringInArray(generalCrashers, sAuthId); + + if (crasherIndex == -1) + return; + + RemoveFromArray(generalCrashers, crasherIndex); + int remainingCrashers = GetArraySize(generalCrashers); + + if (convarDebug.BoolValue) + { + Format(sDebugMessage, sizeof(sDebugMessage), "[Autopause (OnClientPutInServer)] Crashed Player %s rejoined.", sAuthId); + DebugLog(sDebugMessage); + } + + if (convarForceUnpause.BoolValue && bPauseIsAvailable && IsInPause()) + { + if (!remainingCrashers) + { + CPrintToChatAll("{blue}[{default}AutoPause{blue}] {default}All {green}crashed {default}players have reconnected.. {blue}Unpausing{default}!"); + ServerCommand("sm_forceunpause"); + + if (convarDebug.BoolValue) + { + Format(sDebugMessage, sizeof(sDebugMessage), "[Autopause (OnClientPutInServer)] All crashed players rejoined. Force Unpause was triggered."); + DebugLog(sDebugMessage); + } + } + else + CPrintToChatAll("{blue}[{default}AutoPause{blue}] {default}Waiting for {olive}%i {default}more {green}crashed {default}player%s {default}before automatic {blue}Unpause{default}!", remainingCrashers, remainingCrashers > 1 ? "s" : ""); + } +} + +public void Event_RoundStart(Event hEvent, char[] sEventName, bool dontBroadcast) +{ ClearTrie(crashedPlayers); + ClearArray(generalCrashers); ClearArray(infectedPlayers); ClearArray(survivorPlayers); - RoundEnd = false; + bRoundEnd = false; } -public round_end(Handle:event, const String:name[], bool:dontBroadcast) { - RoundEnd = true; +public void Event_RoundEnd(Event hEvent, char[] sEventName, bool dontBroadcast) +{ + bRoundEnd = true; } -// Handles players leaving and joining the infected team. -public playerTeam(Handle:event, const String:name[], bool:dontBroadcast) { - new client = GetClientOfUserId(GetEventInt(event, "userid")); - if (client <= 0 || client > MaxClients) return; - decl String:steamId[64]; - GetClientAuthId(client, AuthId_Steam2, steamId, sizeof(steamId)); - if (strcmp(steamId, "BOT") == 0) return; - new oldTeam = GetEventInt(event, "oldteam"); - new newTeam = GetEventInt(event, "team"); - - new index = FindStringInArray(infectedPlayers, steamId); - new survindex = FindStringInArray(infectedPlayers, steamId); - if (oldTeam == 3) { - if (index != -1) RemoveFromArray(infectedPlayers, index); - if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Removed player %s from infected team.", steamId); +public void Event_PlayerTeam(Event hEvent, char[] sEventName, bool dontBroadcast) +{ + int client = GetClientOfUserId(hEvent.GetInt("userid")); + + if (client <= 0 || client > MaxClients) + return; + + char sAuthId[64]; + GetClientAuthId(client, AuthId_Steam2, sAuthId, sizeof(sAuthId)); + + if (strcmp(sAuthId, "BOT") == 0) + return; + + int survivorIndex = FindStringInArray(survivorPlayers, sAuthId); + int infectedIndex = FindStringInArray(infectedPlayers, sAuthId); + + if (survivorIndex != -1) + { + RemoveFromArray(survivorPlayers, survivorIndex); + + if (convarDebug.BoolValue) + { + Format(sDebugMessage, sizeof(sDebugMessage), "[AutoPause (%s)] Removed player %s from the survivor team.", sEventName, sAuthId); + DebugLog(sDebugMessage); + } } - else if (oldTeam == 2) { - if (survindex != -1) RemoveFromArray(survivorPlayers, survindex); - if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Removed player %s from survivor team.", steamId); + + if (infectedIndex != -1) + { + RemoveFromArray(infectedPlayers, infectedIndex); + + if (convarDebug.BoolValue) + { + Format(sDebugMessage, sizeof(sDebugMessage), "[AutoPause (%s)] Removed player %s from the infected team.", sEventName, sAuthId); + DebugLog(sDebugMessage); + } } - if (newTeam == 3) { - decl Float:spawnTime; - if (GetTrieValue(crashedPlayers, steamId, spawnTime)) { - new CountdownTimer:spawnTimer = L4D2Direct_GetSpawnTimer(client); - CTimer_Start(spawnTimer, spawnTime); - RemoveFromTrie(crashedPlayers, steamId); - LogMessage("[AutoPause] Player %s rejoined, set spawn timer to %f.", steamId, spawnTime); - } else if (index == -1) { - PushArrayString(infectedPlayers, steamId); - if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Added player %s to infected team.", steamId); + + int newTeam = hEvent.GetInt("team"); + + if (newTeam == L4D_TEAM_SURVIVOR) + { + PushArrayString(survivorPlayers, sAuthId); + + if (convarDebug.BoolValue) + { + Format(sDebugMessage, sizeof(sDebugMessage), "[AutoPause (%s)] Added player %s to the survivor team.", sEventName, sAuthId); + DebugLog(sDebugMessage); } } - else if (newTeam == 2 && survindex == -1) { - PushArrayString(survivorPlayers, steamId); - if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Added player %s to survivor team.", steamId); + else if (newTeam == L4D_TEAM_INFECTED) + { + float fSpawnTime; + + if (GetTrieValue(crashedPlayers, sAuthId, fSpawnTime)) + { + CountdownTimer CTimer_SpawnTimer = L4D2Direct_GetSpawnTimer(client); + CTimer_Start(CTimer_SpawnTimer, fSpawnTime); + RemoveFromTrie(crashedPlayers, sAuthId); + + if (convarDebug.BoolValue) + { + Format(sDebugMessage, sizeof(sDebugMessage), "[AutoPause (%s)] Player %s rejoined the infected, set spawn timer to %f.", sEventName, sAuthId, fSpawnTime); + DebugLog(sDebugMessage); + } + } + + PushArrayString(infectedPlayers, sAuthId); + + if (convarDebug.BoolValue) + { + Format(sDebugMessage, sizeof(sDebugMessage), "[AutoPause (%s)] Added player %s to the infected team.", sEventName, sAuthId); + DebugLog(sDebugMessage); + } } } -public playerDisconnect(Handle:event, const String:name[], bool:dontBroadcast) { - new client = GetClientOfUserId(GetEventInt(event, "userid")); - if (client <= 0 || client > MaxClients) return; - decl String:steamId[64]; - GetClientAuthId(client, AuthId_Steam2, steamId, sizeof(steamId)); - if (strcmp(steamId, "BOT") == 0) return; +public void Event_PlayerDisconnect(Event hEvent, char[] sEventName, bool dontBroadcast) +{ + int client = GetClientOfUserId(hEvent.GetInt("userid")); + + if (client <= 0 || client > MaxClients) + return; - // Player wasn't actually a gamer, ignore - if (FindStringInArray(infectedPlayers, steamId) == -1 && FindStringInArray(survivorPlayers, steamId) == -1) return; + char sAuthId[64]; + GetClientAuthId(client, AuthId_Steam2, sAuthId, sizeof(sAuthId)); - decl String:reason[128]; - GetEventString(event, "reason", reason, sizeof(reason)); - decl String:playerName[128]; - GetEventString(event, "name", playerName, sizeof(playerName)); - decl String:timedOut[256]; - Format(timedOut, sizeof(timedOut), "%s timed out", playerName); + if (strcmp(sAuthId, "BOT") == 0) + return; - if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Player %s (%s) left the game: %s", playerName, steamId, reason); + if (FindStringInArray(infectedPlayers, sAuthId) == -1 && FindStringInArray(survivorPlayers, sAuthId) == -1) + return; - // If the leaving player crashed, pause. - if (strcmp(reason, timedOut) == 0 || strcmp(reason, "No Steam logon") == 0) + if (GetClientTeam(client) == L4D_TEAM_SURVIVOR && !IsPlayerAlive(client)) { - if ((!readyUpIsAvailable || !IsInReady()) && !RoundEnd && GetConVarBool(g_hCvarEnabled)) + if (convarDebug.BoolValue) { - if (GetConVarBool(g_hCvarForce)) - { + Format(sDebugMessage, sizeof(sDebugMessage), "[AutoPause (%s)] Player %N left the game but is a dead Survivor", sEventName, client); + DebugLog(sDebugMessage); + } + return; + } + + char sReason[128]; + hEvent.GetString("reason", sReason, sizeof(sReason)); + + char sTimedOut[64]; + Format(sTimedOut, sizeof(sTimedOut), "%N timed out", client); + + if (convarDebug.BoolValue) + { + Format(sDebugMessage, sizeof(sDebugMessage), "[AutoPause (%s)] Player %N (%s) left the game: %s", sEventName, client, sAuthId, sReason); + DebugLog(sDebugMessage); + } + + if (strcmp(sReason, sTimedOut) == 0 || strcmp(sReason, "No Steam logon") == 0) + { + if (convarEnabled.BoolValue && (!bReadyUpIsAvailable || !IsInReady()) && !bRoundEnd) + { + if (convarForce.BoolValue) ServerCommand("sm_forcepause"); - } else - { FakeClientCommand(client, "sm_pause"); - } - CPrintToChatAll("{blue}[{default}AutoPause{blue}] {olive}%s {default}crashed.", playerName); + + if (FindStringInArray(generalCrashers, sAuthId) == -1) + PushArrayString(generalCrashers, sAuthId); + + CPrintToChatAll("{blue}[{default}AutoPause{blue}] {olive}%N {default}crashed.", client); } } - // If the leaving player was on infected, save their spawn timer. - if (FindStringInArray(infectedPlayers, steamId) != -1) { - decl Float:timeLeft; - new CountdownTimer:spawnTimer = L4D2Direct_GetSpawnTimer(client); - if (spawnTimer != CTimer_Null) { - timeLeft = CTimer_GetRemainingTime(spawnTimer); - LogMessage("[AutoPause] Player %s left the game with %f time until spawn.", steamId, timeLeft); - SetTrieValue(crashedPlayers, steamId, timeLeft); + if (FindStringInArray(infectedPlayers, sAuthId) != -1) + { + CountdownTimer CTimer_SpawnTimer = L4D2Direct_GetSpawnTimer(client); + if (CTimer_SpawnTimer != CTimer_Null) + { + float fTimeLeft = CTimer_GetRemainingTime(CTimer_SpawnTimer); + + if (convarDebug.BoolValue) + { + Format(sDebugMessage, sizeof(sDebugMessage), "[AutoPause (%s)] Player %s left the game with %f time until spawn.", sEventName, sAuthId, fTimeLeft); + DebugLog(sDebugMessage); + } + + SetTrieValue(crashedPlayers, sAuthId, fTimeLeft); } } +} + +void DebugLog(char[] sMessage) +{ + int flags = convarDebug.IntValue; + + if (flags & DEBUG_SM) + LogMessage(sMessage); + + if (flags & DEBUG_CHAT) + PrintToChatAll(sMessage); } \ No newline at end of file From 7f6043ba3c559b19f5862aaea7957f1b904a1b7f Mon Sep 17 00:00:00 2001 From: SirPlease Date: Tue, 2 Apr 2024 17:50:12 +0200 Subject: [PATCH 2/2] ZoneMod version change 2.8.9b to 2.8.9c --- addons/sourcemod/configs/matchmodes.txt | 6 +++--- cfg/cfgogl/zh1v1/confogl.cfg | 2 +- cfg/cfgogl/zh2v2/confogl.cfg | 2 +- cfg/cfgogl/zh3v3/confogl.cfg | 2 +- cfg/cfgogl/zm1v1/confogl.cfg | 2 +- cfg/cfgogl/zm2v2/confogl.cfg | 2 +- cfg/cfgogl/zm3v3/confogl.cfg | 2 +- cfg/cfgogl/zonehunters/confogl.cfg | 2 +- cfg/cfgogl/zonemod/confogl.cfg | 2 +- cfg/cfgogl/zoneretro/confogl.cfg | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/addons/sourcemod/configs/matchmodes.txt b/addons/sourcemod/configs/matchmodes.txt index 2f97f9982..36b5ce27e 100644 --- a/addons/sourcemod/configs/matchmodes.txt +++ b/addons/sourcemod/configs/matchmodes.txt @@ -4,11 +4,11 @@ { "zonemod" { - "name" "ZoneMod 2.8.9b" + "name" "ZoneMod 2.8.9c" } "zoneretro" { - "name" "ZoneMod Retro 2.8.9b" + "name" "ZoneMod Retro 2.8.9c" } "zm3v3" { @@ -109,7 +109,7 @@ { "zonehunters" { - "name" "ZoneHunters 2.8.9b" + "name" "ZoneHunters 2.8.9c" } "zh3v3" { diff --git a/cfg/cfgogl/zh1v1/confogl.cfg b/cfg/cfgogl/zh1v1/confogl.cfg index 6a12227c1..e07554963 100644 --- a/cfg/cfgogl/zh1v1/confogl.cfg +++ b/cfg/cfgogl/zh1v1/confogl.cfg @@ -7,7 +7,7 @@ // ======================================================================================= // ReadyUp Cvars -l4d_ready_cfg_name "1v1 [Zone]Hunters v2.8.9b" +l4d_ready_cfg_name "1v1 [Zone]Hunters v2.8.9c" // Confogl Cvars confogl_addcvar mp_gamemode "versus" // Force Versus for the config. diff --git a/cfg/cfgogl/zh2v2/confogl.cfg b/cfg/cfgogl/zh2v2/confogl.cfg index b27d3c824..d11a8bde2 100644 --- a/cfg/cfgogl/zh2v2/confogl.cfg +++ b/cfg/cfgogl/zh2v2/confogl.cfg @@ -7,7 +7,7 @@ // ======================================================================================= // ReadyUp Cvars -l4d_ready_cfg_name "2v2 [Zone]Hunters v2.8.9b" +l4d_ready_cfg_name "2v2 [Zone]Hunters v2.8.9c" // Confogl Cvars confogl_addcvar mp_gamemode "versus" // Force Versus for the config. diff --git a/cfg/cfgogl/zh3v3/confogl.cfg b/cfg/cfgogl/zh3v3/confogl.cfg index 925e38f96..dc28d7081 100644 --- a/cfg/cfgogl/zh3v3/confogl.cfg +++ b/cfg/cfgogl/zh3v3/confogl.cfg @@ -7,7 +7,7 @@ // ======================================================================================= // ReadyUp Cvars -l4d_ready_cfg_name "3v3 [Zone]Hunters v2.8.9b" +l4d_ready_cfg_name "3v3 [Zone]Hunters v2.8.9c" // Confogl Cvars confogl_addcvar mp_gamemode "versus" // Force Versus for the config. diff --git a/cfg/cfgogl/zm1v1/confogl.cfg b/cfg/cfgogl/zm1v1/confogl.cfg index 1d1a3622c..f98828782 100644 --- a/cfg/cfgogl/zm1v1/confogl.cfg +++ b/cfg/cfgogl/zm1v1/confogl.cfg @@ -8,7 +8,7 @@ // ======================================================================================= // ReadyUp Cvars -l4d_ready_cfg_name "1v1 Zonemod v2.8.9b" +l4d_ready_cfg_name "1v1 Zonemod v2.8.9c" // Confogl Cvars confogl_addcvar mp_gamemode "versus" // Force Versus for the config. diff --git a/cfg/cfgogl/zm2v2/confogl.cfg b/cfg/cfgogl/zm2v2/confogl.cfg index ff3ce7022..e4c48f4f6 100644 --- a/cfg/cfgogl/zm2v2/confogl.cfg +++ b/cfg/cfgogl/zm2v2/confogl.cfg @@ -8,7 +8,7 @@ // ======================================================================================= // ReadyUp Cvars -l4d_ready_cfg_name "2v2 Zonemod v2.8.9b" +l4d_ready_cfg_name "2v2 Zonemod v2.8.9c" // Confogl Cvars confogl_addcvar mp_gamemode "versus" // Force Versus for the config. diff --git a/cfg/cfgogl/zm3v3/confogl.cfg b/cfg/cfgogl/zm3v3/confogl.cfg index 02ac843ce..079cda6dd 100644 --- a/cfg/cfgogl/zm3v3/confogl.cfg +++ b/cfg/cfgogl/zm3v3/confogl.cfg @@ -8,7 +8,7 @@ // ======================================================================================= // ReadyUp Cvars -l4d_ready_cfg_name "3v3 Zonemod v2.8.9b" +l4d_ready_cfg_name "3v3 Zonemod v2.8.9c" // Confogl Cvars confogl_addcvar mp_gamemode "versus" // Force Versus for the config. diff --git a/cfg/cfgogl/zonehunters/confogl.cfg b/cfg/cfgogl/zonehunters/confogl.cfg index 6b03cd945..6e3b8f2d8 100644 --- a/cfg/cfgogl/zonehunters/confogl.cfg +++ b/cfg/cfgogl/zonehunters/confogl.cfg @@ -7,7 +7,7 @@ // ======================================================================================= // ReadyUp Cvars -l4d_ready_cfg_name "[Zone]Hunters v2.8.9b" +l4d_ready_cfg_name "[Zone]Hunters v2.8.9c" // Confogl Cvars confogl_addcvar mp_gamemode "versus" // Force Versus for the config. diff --git a/cfg/cfgogl/zonemod/confogl.cfg b/cfg/cfgogl/zonemod/confogl.cfg index 4a9877ffc..6a9c0d2bb 100644 --- a/cfg/cfgogl/zonemod/confogl.cfg +++ b/cfg/cfgogl/zonemod/confogl.cfg @@ -8,7 +8,7 @@ // ======================================================================================= // ReadyUp Cvars -l4d_ready_cfg_name "ZoneMod v2.8.9b" +l4d_ready_cfg_name "ZoneMod v2.8.9c" // Confogl Cvars confogl_addcvar mp_gamemode "versus" // Force Versus for the config. diff --git a/cfg/cfgogl/zoneretro/confogl.cfg b/cfg/cfgogl/zoneretro/confogl.cfg index 605bb8ab5..ec60c8fd8 100644 --- a/cfg/cfgogl/zoneretro/confogl.cfg +++ b/cfg/cfgogl/zoneretro/confogl.cfg @@ -8,7 +8,7 @@ // ======================================================================================= // ReadyUp Cvars -l4d_ready_cfg_name "ZoneMod Retro v2.8.9b" +l4d_ready_cfg_name "ZoneMod Retro v2.8.9c" // Confogl Cvars confogl_addcvar mp_gamemode "versus" // Force Versus for the config.