diff --git a/src/zr/damage.inc b/src/zr/damage.inc index df00f71..f0c2f0a 100644 --- a/src/zr/damage.inc +++ b/src/zr/damage.inc @@ -413,7 +413,7 @@ public Action:DamageSuicideIntercept(client, argc) // match, block it. // Check general criterias. - if ((suicideAfterInfect && !g_bZombieSpawned) || // Check if it should block suicides before mother zombie. + if ((suicideAfterInfect && !InfectHasZombieSpawned()) || // Check if it should block suicides before mother zombie. !ZRIsClientValid(client) || // Validate client (to stop console). !IsPlayerAlive(client)) // Check if dead. { diff --git a/src/zr/immunityhandler.inc b/src/zr/immunityhandler.inc index b862fdf..415f1a2 100644 --- a/src/zr/immunityhandler.inc +++ b/src/zr/immunityhandler.inc @@ -1048,7 +1048,7 @@ bool:ImmunityCanDeployShield(client, bool:printResponse = true) } // Humans cannot deploy shield before first zombie. - if (!g_bZombieSpawned) + if (!InfectHasZombieSpawned()) { return false; } diff --git a/src/zr/infect.inc b/src/zr/infect.inc index aa58ee4..2ed4866 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -158,7 +158,7 @@ InfectOnClientDisconnect(client) } // If zombie hasn't spawned, then stop. - if (!g_bZombieSpawned) + if (!InfectHasZombieSpawned()) { return; } @@ -270,13 +270,10 @@ InfectOnClientSpawn(client) bZombie[client] = false; // Check if client is spawning on the terrorist team. - if (ZRIsClientOnTeam(client, CS_TEAM_T)) + if (ZRIsClientOnTeam(client, CS_TEAM_T) && InfectHasZombieSpawned()) { - if (g_bZombieSpawned) - { - CS_SwitchTeam(client, CS_TEAM_CT); - CS_RespawnPlayer(client); - } + CS_SwitchTeam(client, CS_TEAM_CT); + CS_RespawnPlayer(client); } } @@ -385,7 +382,7 @@ InfectOnRoundFreezeEnd() ZREndTimer(tInfectCountdown); // If the zombie has spawned already (had to be through admin) then stop. - if (g_bZombieSpawned) + if (InfectHasZombieSpawned()) { return; } @@ -1074,6 +1071,11 @@ public InfectMenuClientsHandle(Handle:menu_infect_clients, MenuAction:action, cl } } +bool:InfectHasZombieSpawned() +{ + return g_bZombieSpawned; +} + /** * Returns if a client is infected. * @@ -1121,7 +1123,7 @@ bool:InfectIsClientHuman(client) */ stock InfectManualInfect(client, targets[], count, bool:respawnoverride = false, bool:respawn = false) { - new bool:zombiespawned = g_bZombieSpawned; + new bool:zombiespawned = InfectHasZombieSpawned(); // If zombie hasn't spawned, then make targetted player(s) mother zombies. if (!zombiespawned) diff --git a/src/zr/respawn.inc b/src/zr/respawn.inc index e6a2c9a..a7e5392 100644 --- a/src/zr/respawn.inc +++ b/src/zr/respawn.inc @@ -184,7 +184,7 @@ bool:RespawnSpawnClient(client, bool:zombie = false, bool:zombieIfSuicide = fals CS_RespawnPlayer(client); // Check if first zombie has spawned. - if (g_bZombieSpawned) + if (InfectHasZombieSpawned()) { // Infect if player should spawn as zombie. if (zombie) diff --git a/src/zr/roundend.inc b/src/zr/roundend.inc index b800304..4cc9ea4 100644 --- a/src/zr/roundend.inc +++ b/src/zr/roundend.inc @@ -260,7 +260,7 @@ public Action:RoundEndTimer(Handle:timer) bool:RoundEndGetRoundStatus(&RoundEndOutcome:outcome) { // If zombie hasn't spawned, then stop. - if (!g_bZombieSpawned) + if (!InfectHasZombieSpawned()) { // Round isn't over. return false; diff --git a/src/zr/spawnprotect.inc b/src/zr/spawnprotect.inc index 1f30fa9..b246519 100644 --- a/src/zr/spawnprotect.inc +++ b/src/zr/spawnprotect.inc @@ -113,7 +113,7 @@ SpawnProtectStart(client) } // If zombie hasn't spawned, then stop. - if (!g_bZombieSpawned) + if (!InfectHasZombieSpawned()) { return; } diff --git a/src/zr/zombiereloaded.inc b/src/zr/zombiereloaded.inc index d9aa4db..24b3302 100644 --- a/src/zr/zombiereloaded.inc +++ b/src/zr/zombiereloaded.inc @@ -244,7 +244,7 @@ stock bool:ZRIsConsole(index) stock bool:ZRCountValidClients(&zombiecount = 0, &humancount = 0, bool:alive = true, bool:ignorezombiespawned = false) { // If zombie hasn't spawned and were not only counting humans, then stop. - if (!g_bZombieSpawned && !ignorezombiespawned) + if (!InfectHasZombieSpawned() && !ignorezombiespawned) { return false; } diff --git a/src/zr/ztele.inc b/src/zr/ztele.inc index 62cbda4..4044184 100644 --- a/src/zr/ztele.inc +++ b/src/zr/ztele.inc @@ -140,7 +140,7 @@ bool:ZTeleClient(client, bool:force = false) // If zombie has spawned, get before value, get the after value otherwise. // If the cvar is disabled and the client is a human, then stop. - new bool:ztelehuman = g_bZombieSpawned ? GetConVarBool(g_hCvarsList[CVAR_ZTELE_HUMAN_AFTER]) : GetConVarBool(g_hCvarsList[CVAR_ZTELE_HUMAN_BEFORE]); + new bool:ztelehuman = InfectHasZombieSpawned() ? GetConVarBool(g_hCvarsList[CVAR_ZTELE_HUMAN_AFTER]) : GetConVarBool(g_hCvarsList[CVAR_ZTELE_HUMAN_BEFORE]); if (!force && !infected && !ztelehuman) { // Tell client that feature is restricted at this time.