Add InfectHasZombieSpawned.

This commit is contained in:
Richard Helgeby 2015-03-22 18:06:40 +01:00
parent 583984489b
commit 7ce73b4493
8 changed files with 18 additions and 16 deletions

View File

@ -413,7 +413,7 @@ public Action:DamageSuicideIntercept(client, argc)
// match, block it. // match, block it.
// Check general criterias. // 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). !ZRIsClientValid(client) || // Validate client (to stop console).
!IsPlayerAlive(client)) // Check if dead. !IsPlayerAlive(client)) // Check if dead.
{ {

View File

@ -1048,7 +1048,7 @@ bool:ImmunityCanDeployShield(client, bool:printResponse = true)
} }
// Humans cannot deploy shield before first zombie. // Humans cannot deploy shield before first zombie.
if (!g_bZombieSpawned) if (!InfectHasZombieSpawned())
{ {
return false; return false;
} }

View File

@ -158,7 +158,7 @@ InfectOnClientDisconnect(client)
} }
// If zombie hasn't spawned, then stop. // If zombie hasn't spawned, then stop.
if (!g_bZombieSpawned) if (!InfectHasZombieSpawned())
{ {
return; return;
} }
@ -270,14 +270,11 @@ InfectOnClientSpawn(client)
bZombie[client] = false; bZombie[client] = false;
// Check if client is spawning on the terrorist team. // 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_SwitchTeam(client, CS_TEAM_CT);
CS_RespawnPlayer(client); CS_RespawnPlayer(client);
} }
}
} }
/** /**
@ -385,7 +382,7 @@ InfectOnRoundFreezeEnd()
ZREndTimer(tInfectCountdown); ZREndTimer(tInfectCountdown);
// If the zombie has spawned already (had to be through admin) then stop. // If the zombie has spawned already (had to be through admin) then stop.
if (g_bZombieSpawned) if (InfectHasZombieSpawned())
{ {
return; 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. * Returns if a client is infected.
* *
@ -1121,7 +1123,7 @@ bool:InfectIsClientHuman(client)
*/ */
stock InfectManualInfect(client, targets[], count, bool:respawnoverride = false, bool:respawn = false) 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 zombie hasn't spawned, then make targetted player(s) mother zombies.
if (!zombiespawned) if (!zombiespawned)

View File

@ -184,7 +184,7 @@ bool:RespawnSpawnClient(client, bool:zombie = false, bool:zombieIfSuicide = fals
CS_RespawnPlayer(client); CS_RespawnPlayer(client);
// Check if first zombie has spawned. // Check if first zombie has spawned.
if (g_bZombieSpawned) if (InfectHasZombieSpawned())
{ {
// Infect if player should spawn as zombie. // Infect if player should spawn as zombie.
if (zombie) if (zombie)

View File

@ -260,7 +260,7 @@ public Action:RoundEndTimer(Handle:timer)
bool:RoundEndGetRoundStatus(&RoundEndOutcome:outcome) bool:RoundEndGetRoundStatus(&RoundEndOutcome:outcome)
{ {
// If zombie hasn't spawned, then stop. // If zombie hasn't spawned, then stop.
if (!g_bZombieSpawned) if (!InfectHasZombieSpawned())
{ {
// Round isn't over. // Round isn't over.
return false; return false;

View File

@ -113,7 +113,7 @@ SpawnProtectStart(client)
} }
// If zombie hasn't spawned, then stop. // If zombie hasn't spawned, then stop.
if (!g_bZombieSpawned) if (!InfectHasZombieSpawned())
{ {
return; return;
} }

View File

@ -244,7 +244,7 @@ stock bool:ZRIsConsole(index)
stock bool:ZRCountValidClients(&zombiecount = 0, &humancount = 0, bool:alive = true, bool:ignorezombiespawned = false) 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 zombie hasn't spawned and were not only counting humans, then stop.
if (!g_bZombieSpawned && !ignorezombiespawned) if (!InfectHasZombieSpawned() && !ignorezombiespawned)
{ {
return false; return false;
} }

View File

@ -140,7 +140,7 @@ bool:ZTeleClient(client, bool:force = false)
// If zombie has spawned, get before value, get the after value otherwise. // 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. // 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) if (!force && !infected && !ztelehuman)
{ {
// Tell client that feature is restricted at this time. // Tell client that feature is restricted at this time.