diff --git a/scripting/tf2-comp-fixes.sp b/scripting/tf2-comp-fixes.sp index 56c3f72..1d33d81 100644 --- a/scripting/tf2-comp-fixes.sp +++ b/scripting/tf2-comp-fixes.sp @@ -121,7 +121,7 @@ void OnLibraryAdded(const char[] name) { } public -void OnMapStart() { FixPostPauseState_OnMapStart(); } +void OnGameFrame() { FixPostPauseState_OnGameFrame(); } public void OnClientPutInServer(int client) { diff --git a/scripting/tf2-comp-fixes/fix-post-pause-state.sp b/scripting/tf2-comp-fixes/fix-post-pause-state.sp index 97508ff..1f1d81a 100644 --- a/scripting/tf2-comp-fixes/fix-post-pause-state.sp +++ b/scripting/tf2-comp-fixes/fix-post-pause-state.sp @@ -14,7 +14,21 @@ void FixPostPauseState_Setup() { CreateBoolConVar("sm_fix_post_pause_state", WhenConVarChange); } -void FixPostPauseState_OnMapStart() { g_paused = false; } +void FixPostPauseState_OnGameFrame() +{ + static float lastGameTime = -1.0; + float flCurrentGameTime = GetGameTime(); + + if (flCurrentGameTime == lastGameTime) + { + g_paused = true; + } + else + { + g_paused = false; + lastGameTime = flCurrentGameTime; + } +} static void WhenConVarChange(ConVar cvar, const char[] before, const char[] after) { if (cvar.BoolValue == TruthyConVar(before)) { @@ -69,7 +83,5 @@ static Action WhenPause(int author, const char[] command, int argc) { } } - g_paused = !g_paused; - return Plugin_Continue; }