Fixed spawn protect firing twice causing the timer to execute twice a second, halving the time.

This commit is contained in:
Greyscale 2009-06-26 23:28:46 -07:00
parent 85c3400a62
commit ca820b6b53
2 changed files with 12 additions and 15 deletions

View File

@ -187,7 +187,6 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad
WeaponsOnClientSpawn(index); WeaponsOnClientSpawn(index);
RoundStartOnClientSpawn(index); RoundStartOnClientSpawn(index);
SEffectsOnClientSpawn(index); SEffectsOnClientSpawn(index);
SpawnProtectOnClientSpawn(index);
RespawnOnClientSpawn(index); RespawnOnClientSpawn(index);
ZTeleOnClientSpawn(index); ZTeleOnClientSpawn(index);
ZHPOnClientSpawn(index); ZHPOnClientSpawn(index);

View File

@ -47,14 +47,17 @@ SpawnProtectClientInit(client)
} }
/** /**
* Client is spawning into the game. * Client is spawning into the game. *Post
* *
* @param client The client index. * @param client The client index.
*/ */
SpawnProtectOnClientSpawn(client) SpawnProtectOnClientSpawnPost(client)
{ {
// Disable spawn protection on client. // If client is dead, then they are joining the server, not spawning.
bInfectImmune[client][INFECT_TYPE_NORMAL] = false; if (!IsPlayerAlive(client))
{
return;
}
// If timer is currently running, kill it. // If timer is currently running, kill it.
if (tSpawnProtect[client] != INVALID_HANDLE) if (tSpawnProtect[client] != INVALID_HANDLE)
@ -64,15 +67,7 @@ SpawnProtectOnClientSpawn(client)
// Reset timer handle. // Reset timer handle.
tSpawnProtect[client] = INVALID_HANDLE; tSpawnProtect[client] = INVALID_HANDLE;
}
/**
* Client is spawning into the game. *Post
*
* @param client The client index.
*/
SpawnProtectOnClientSpawnPost(client)
{
// If protect cvar is disabled, then stop. // If protect cvar is disabled, then stop.
new bool:protect = GetConVarBool(g_hCvarsList[CVAR_SPAWNPROTECT]); new bool:protect = GetConVarBool(g_hCvarsList[CVAR_SPAWNPROTECT]);
if (!protect) if (!protect)
@ -80,6 +75,9 @@ SpawnProtectOnClientSpawnPost(client)
return; return;
} }
// Disable spawn protection on client.
bInfectImmune[client][INFECT_TYPE_NORMAL] = false;
// Start spawn protection. // Start spawn protection.
SpawnProtectStart(client); SpawnProtectStart(client);
} }