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.
// 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.
{

View File

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

View File

@ -158,7 +158,7 @@ InfectOnClientDisconnect(client)
}
// If zombie hasn't spawned, then stop.
if (!g_bZombieSpawned)
if (!InfectHasZombieSpawned())
{
return;
}
@ -270,14 +270,11 @@ InfectOnClientSpawn(client)
bZombie[client] = false;
// Check if client is spawning on the terrorist team.
if (ZRIsClientOnTeam(client, CS_TEAM_T))
{
if (g_bZombieSpawned)
if (ZRIsClientOnTeam(client, CS_TEAM_T) && InfectHasZombieSpawned())
{
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)

View File

@ -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)

View File

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

View File

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

View File

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

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 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.