hopefully fixed that its always detected when bots are missing

This commit is contained in:
jenz 2024-01-31 00:36:51 +01:00
parent 7b7f7a424b
commit caf674479c

View File

@ -158,6 +158,7 @@ public Action CheckPlayerTeam(Handle timer, any userid)
if (client == 0)
return Plugin_Continue;
checkIfRestartNeeded();
if (!IsValidClient(client) || IsPlayerAlive(client) || (GetClientTeam(client) != CS_TEAM_T && GetClientTeam(client) != CS_TEAM_CT)
|| IsFakeClient(client))
{
@ -210,7 +211,7 @@ public Action Timer_CheckIfRestartNeeded(Handle timer, any userid)
return Plugin_Handled;
}
public Action ApplySettings(Event event, const char[] name, bool dontBroadcast)
public void checkIfRestartNeeded()
{
int activeBots = 0;
int activePlayers = 0;
@ -237,7 +238,11 @@ public Action ApplySettings(Event event, const char[] name, bool dontBroadcast)
{
CreateTimer(10.0, Timer_CheckIfRestartNeeded); //if only one guy is on a team we force a restart to spawn the bots.
}
}
public Action ApplySettings(Event event, const char[] name, bool dontBroadcast)
{
checkIfRestartNeeded();
int client = GetClientOfUserId(event.GetInt("userid"));
if (!IsValidClient(client) || !IsPlayerAlive(client) || IsClientSourceTV(client))