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; } } }