Browse Source

Suspend bot checks during a sudden death

nosoop 6 years ago
parent
commit
cbcf24152e
1 changed files with 8 additions and 2 deletions
  1. 8 2
      scripting/botmanager.sp

+ 8 - 2
scripting/botmanager.sp

@@ -5,7 +5,7 @@
 #include <tf2>
 #include <tf2_stocks>
 
-#define PLUGIN_VERSION			"1.3.0"
+#define PLUGIN_VERSION			"1.3.1"
 
 public Plugin:myinfo = {
 	name		= "[TF2] Bot Manager",
@@ -94,6 +94,11 @@ public OnMapEnd() {
 }
 
 public Action:Timer_CheckBotNum(Handle:timer) {
+	if (GameRules_GetProp("m_nGameType") == 4 && GameRules_GetRoundState() == RoundState_Stalemate) {
+		// suspend bot checks during an active arena round
+		return Plugin_Continue;
+	}
+	
 	new clients = GetValidClientCount();
 	new actual = GetValidClientCount(false);
 	new bots = GetBotCount();
@@ -102,7 +107,7 @@ public Action:Timer_CheckBotNum(Handle:timer) {
 		if(bots > 0) {
 			RemoveBot();
 		}
-		return;
+		return Plugin_Continue;
 	}
 	if(GetConVarInt(cvarBotQuota) >= MaxClients) {
 		LogMessage("sm_bot_quota cannot be greater than or equal to maxplayers. Setting sm_bot_quota to \"%d\".", MaxClients - 1);
@@ -113,6 +118,7 @@ public Action:Timer_CheckBotNum(Handle:timer) {
 	} else if(clients > GetConVarInt(cvarBotQuota) && bots > 0) {
 		RemoveBot();
 	}
+	return Plugin_Continue;
 }
 
 GetValidClientCount(bool:excludeTeamsOnly = true) {