changed autism bot checks to when players connect, changed so autism bots are eligble for being infected too if only one valid player is present to prevent infinite suicide loop

This commit is contained in:
jenz 2023-09-11 19:30:06 +02:00
parent 5e026ff7f3
commit a473f3d6ec

View File

@ -23,6 +23,8 @@ int g_iZShield[MAXPLAYERS + 1];
bool g_bShield;
bool g_bZombieDrown;
bool autismbot[MAXPLAYERS + 1];
bool g_Plugin_entWatch;
int g_iAFKTime;
@ -144,6 +146,12 @@ public void OnClientDisconnect(int client)
g_iZHPMax[client] = 0;
g_iZShield[client] = 0;
g_bMotherZM[client] = false;
autismbot[client] = false;
}
public void OnClientPostAdminCheck(int client)
{
is_autism_bot(client);
}
/*public void ShowSettingsMenu(int client)
@ -248,7 +256,7 @@ public Action ZR_OnClientMotherZombieEligible(int client)
bHasItem = EW_ClientHasItem(client);
#endif
if (is_autism_bot(client))
if (autismbot[client])
{
int valid_humans = 0;
//if less than two mother zombies should spawn dont infect bots. this is simply because of williams request
@ -256,11 +264,13 @@ public Action ZR_OnClientMotherZombieEligible(int client)
infection_count = FindConVar("zr_infect_mzombie_ratio");
for (int clienti = 1; clienti <= MaxClients; clienti++)
{
if (!IsValidClient(clienti) || !IsPlayerAlive(clienti) || is_autism_bot(clienti)) continue;
if (!IsValidClient(clienti) || !IsPlayerAlive(clienti) || autismbot[clienti]) continue;
valid_humans++;
}
//if less than two mother zombies can spawn dont infect the bots. requested by william that the bots are considered when infecting
if (valid_humans / infection_count.IntValue < 2)
//2023 11th september: if there is only one valid_humans the autism bots should still be eligible
//otherwise the one valid human would infinitely continue being mother zombie and round restarting duing to bots suiciding.
if (valid_humans / infection_count.IntValue < 2 && valid_humans > 1)
{
return Plugin_Handled;
}
@ -277,11 +287,11 @@ public Action ZR_OnClientMotherZombieEligible(int client)
return Plugin_Continue;
}
public bool is_autism_bot(int client)
public void is_autism_bot(int client)
{
char sAuthID[32];
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID)); //autism bot
return StrEqual(sAuthID, "STEAM_0:1:60189040") || StrEqual(sAuthID, "STEAM_0:0:518094602") || StrEqual(sAuthID, "STEAM_0:0:204398871") || StrEqual(sAuthID, "STEAM_0:0:610560766");
autismbot[client] = StrEqual(sAuthID, "STEAM_0:1:60189040") || StrEqual(sAuthID, "STEAM_0:0:518094602") || StrEqual(sAuthID, "STEAM_0:0:204398871") || StrEqual(sAuthID, "STEAM_0:0:610560766");
}
stock bool IsValidClient(int client)