diff --git a/src/zr/infect.inc b/src/zr/infect.inc index e1b9ac8..4a6721c 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -32,7 +32,6 @@ #tryinclude "AFKManager.inc" #tryinclude "TeamManager.inc" -#include "unloze_playtime.inc" /* Restore old REQUIRE_PLUGIN value if necessary */ #if defined TEMP_REQUIRE_PLUGIN @@ -707,24 +706,17 @@ public Action:InfectMotherZombie(Handle:timer) // Infect one of the main candidates. if (candidatesMain) { - // Find lowest tier candidate. - new lowestIndex = 0; - new lowestTier = GetPlayerTier_native(GetArrayCell(aCandidatesMain, 0)); - for (new n = 1; n < candidatesMain; n++) - { - new tier = GetPlayerTier_native(GetArrayCell(aCandidatesMain, n)); - if (tier < lowestTier) - { - lowestTier = tier; - lowestIndex = n; - } - } - new client = GetArrayCell(aCandidatesMain, lowestIndex); + // Get a random array index. + new i = Math_GetRandomInt(0, candidatesMain - 1); + // Get the client stored in the random array index. + new client = GetArrayCell(aCandidatesMain, i); + // Infect player. if (InfectHumanToZombie(client, _, true)) infected++; - RemoveFromArray(aCandidatesMain, lowestIndex); + // Remove player from eligible client list. + RemoveFromArray(aCandidatesMain, i); candidatesMain--; } else @@ -744,24 +736,17 @@ public Action:InfectMotherZombie(Handle:timer) // Infect one of the alternate candidates. if (candidatesAlt) { - // Find lowest tier candidate. - new lowestIndex = 0; - new lowestTier = GetPlayerTier_native(GetArrayCell(aCandidatesAlt, 0)); - for (new n = 1; n < candidatesAlt; n++) - { - new tier = GetPlayerTier_native(GetArrayCell(aCandidatesAlt, n)); - if (tier < lowestTier) - { - lowestTier = tier; - lowestIndex = n; - } - } - new client = GetArrayCell(aCandidatesAlt, lowestIndex); + // Get a random array index. + new i = Math_GetRandomInt(0, candidatesAlt - 1); + // Get the client stored in the random array index. + new client = GetArrayCell(aCandidatesAlt, i); + // Infect player. if (InfectHumanToZombie(client, _, true)) infected++; - RemoveFromArray(aCandidatesAlt, lowestIndex); + // Remove player from eligible client list. + RemoveFromArray(aCandidatesAlt, i); candidatesAlt--; } else // We have no candidates at all. time to fuck over random people!