diff --git a/ZombieManager/scripting/ZombieManager.sp b/ZombieManager/scripting/ZombieManager.sp index 1a59cb7d..62239bfd 100755 --- a/ZombieManager/scripting/ZombieManager.sp +++ b/ZombieManager/scripting/ZombieManager.sp @@ -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; @@ -140,10 +142,16 @@ public void OnClientPutInServer(int client) public void OnClientDisconnect(int client) { - //g_bZHP[client] = false; - g_iZHPMax[client] = 0; - g_iZShield[client] = 0; - g_bMotherZM[client] = false; + //g_bZHP[client] = false; + 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)