diff --git a/src/zr/event.inc b/src/zr/event.inc index d462b4a..40fc65c 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -187,7 +187,6 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad WeaponsOnClientSpawn(index); RoundStartOnClientSpawn(index); SEffectsOnClientSpawn(index); - SpawnProtectOnClientSpawn(index); RespawnOnClientSpawn(index); ZTeleOnClientSpawn(index); ZHPOnClientSpawn(index); diff --git a/src/zr/spawnprotect.inc b/src/zr/spawnprotect.inc index 5baed7e..374cf03 100644 --- a/src/zr/spawnprotect.inc +++ b/src/zr/spawnprotect.inc @@ -47,14 +47,17 @@ SpawnProtectClientInit(client) } /** - * Client is spawning into the game. + * Client is spawning into the game. *Post * * @param client The client index. - */ -SpawnProtectOnClientSpawn(client) + */ +SpawnProtectOnClientSpawnPost(client) { - // Disable spawn protection on client. - bInfectImmune[client][INFECT_TYPE_NORMAL] = false; + // If client is dead, then they are joining the server, not spawning. + if (!IsPlayerAlive(client)) + { + return; + } // If timer is currently running, kill it. if (tSpawnProtect[client] != INVALID_HANDLE) @@ -64,15 +67,7 @@ SpawnProtectOnClientSpawn(client) // Reset timer 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. new bool:protect = GetConVarBool(g_hCvarsList[CVAR_SPAWNPROTECT]); if (!protect) @@ -80,6 +75,9 @@ SpawnProtectOnClientSpawnPost(client) return; } + // Disable spawn protection on client. + bInfectImmune[client][INFECT_TYPE_NORMAL] = false; + // Start spawn protection. SpawnProtectStart(client); }