From 111d7a7374aadb04421d67be7c5b01791cdd9d17 Mon Sep 17 00:00:00 2001 From: jenz Date: Tue, 19 Dec 2023 20:09:38 +0100 Subject: [PATCH] instead of just infecting one left over we keep infecting people until hitting the required amount. We should no longer experience cases of missing main or alt candidates due to updating zombiemanager --- src/zr/infect.inc | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/zr/infect.inc b/src/zr/infect.inc index 06fd9e5..d204b95 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -748,23 +748,22 @@ public Action:InfectMotherZombie(Handle:timer) RemoveFromArray(aCandidatesAlt, i); candidatesAlt--; } - else // We have no candidates at all, abort! + else // We have no candidates at all. time to fuck over random people! { - /* - ghostie complained about how we often dont have a mother zombie when its a low playercount. we just need to infect one guy on - these rounds, stuff like ZombieManager and PlayerRanking (topdefender) interfere with people who can be infected. - Sometimes when only one mother zombie should spawn we end up with rounds that dont have any mother zombie at all - despite having human clients who play. 2023 11th september. - */ - for (new n = 0; n < eligibleclients; n++) + // Infect player. + if (eligibleclients) { - //we just pick a random client here inside of the loop because it ensures that at least one client exists. - new randindex = Math_GetRandomInt(0, eligibleclients - 1); + new randindex = MathGetRandomInt(0, eligibleclients - 1); new client = GetArrayCell(arrayEligibleClients, randindex); - InfectHumanToZombie(client, _, true); - break; + if (InfectHumanToZombie(client, , true)) + { + infected++; + } + } + else + { + break; //prevent infinite loop. should be very unlikely we end up here. } - break; } } }