From a5985d64d9a8b4acc61d074b72d63794d1890534 Mon Sep 17 00:00:00 2001 From: Jackz Date: Thu, 18 Nov 2021 10:31:44 -0600 Subject: [PATCH] Fix autorestart incorrectly restarting on map changes --- scripting/l4d2_autorestart.sp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripting/l4d2_autorestart.sp b/scripting/l4d2_autorestart.sp index 7a0f8eb..5f8ee8e 100644 --- a/scripting/l4d2_autorestart.sp +++ b/scripting/l4d2_autorestart.sp @@ -50,18 +50,19 @@ public Action Timer_Check(Handle h) { LogAction(0, -1, "Detected server in hibernation with no players, restarting..."); ServerCommand("quit"); } + return Plugin_Continue; } else if(GetTime() - startupTime > MAX_TIME_ONLINE_MS) { LogAction(0, -1, "Server has passed max online time threshold, will restart if remains empty"); if(IsServerEmpty()) { - if(++triesEmpty > 2) { - LogAction(0, -1, "Server has passed max online time threshold and is empty, restarting now"); + if(++triesEmpty > 3) { + LogAction(0, -1, "Server has passed max online time threshold and is empty after %d tries, restarting now", triesEmpty); ServerCommand("quit"); } + return Plugin_Continue; } - } else { - triesBots = 0; - triesEmpty = 0; } + triesBots = 0; + triesEmpty = 0; return Plugin_Continue; }