diff --git a/src/zr/event.inc b/src/zr/event.inc index f6a92ba..48e5438 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -210,8 +210,7 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) new index = GetClientOfUserId(GetEventInt(event, "userid")); new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); - // Reset field of view and extinguish fire. - SetPlayerFOV(index, DEFAULT_FOV); + // Extinguish fire. ExtinguishEntity(index); // Get the weapon name. @@ -243,9 +242,11 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) } else { + // Reset field of view. + SetPlayerFOV(index, DEFAULT_FOV); + if (IsPlayerZombie(index)) { - // Give kill bonus. if (ZRIsValidClient(attacker)) { @@ -253,15 +254,15 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) AddPlayerScore(attacker, bonus); } } + + // Forward event to modules. + ClassOnClientDeath(index); + SEffectsOnClientDeath(index); + SpawnProtectOnClientDeath(index); + RespawnOnClientDeath(index, attacker, weapon); + ZHPOnClientDeath(index); } - // Forward event to modules. - ClassOnClientDeath(index); - SEffectsOnClientDeath(index); - SpawnProtectOnClientDeath(index); - RespawnOnClientDeath(index, attacker, weapon); - ZHPOnClientDeath(index); - new RoundEndOutcome:outcome; if (RoundEndGetRoundStatus(outcome)) { diff --git a/src/zr/teleport.inc b/src/zr/teleport.inc index 9510ae5..ad1c2b9 100644 --- a/src/zr/teleport.inc +++ b/src/zr/teleport.inc @@ -6,6 +6,17 @@ * ==================== */ +new Float:spawnLoc[MAXPLAYERS + 1][3]; +new Float:bufferLoc[MAXPLAYERS + 1][3]; +new bool:ztele_spawned[MAXPLAYERS + 1] = {false, ...}; +new bool:bufferLocSaved[MAXPLAYERS + 1] = {false, ...}; +new ztele_countdown[MAXPLAYERS + 1] = {-1, ...}; +new ztele_count[MAXPLAYERS + 1]; +new bool:ztele_online = false; +new Handle:ztele_startup_timer = INVALID_HANDLE; +new Handle:ztele_countdown_timer[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; +new Handle:ztele_cooldown_timer[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; + ZTeleEnable() { ztele_online = false; @@ -96,6 +107,12 @@ ZTeleClientSpawned(client) } } +TeleportOnClientInfected(client) +{ + ztele_count[client] = 0; + AbortTeleport(client); +} + public Action:Event_TeleporterStartup(Handle:timer) { ztele_online = true; diff --git a/src/zr/zombie.inc b/src/zr/zombie.inc index 364b38f..dc67bfe 100644 --- a/src/zr/zombie.inc +++ b/src/zr/zombie.inc @@ -253,40 +253,13 @@ public Action:MotherZombie(Handle:timer) */ InfectPlayer(client, attacker = -1, bool:motherinfect = false) { - // Check if the attacker was specified. - if (ZRIsValidClient(attacker)) - { - // Fire death event and set weapon info. - new Handle:event = CreateEvent("player_death"); - if (event != INVALID_HANDLE) - { - SetEventInt(event, "userid", GetClientUserId(client)); - SetEventInt(event, "attacker", GetClientUserId(attacker)); - SetEventString(event, "weapon", "zombie_claws_of_death"); - FireEvent(event, false); - } - } - - // Set player status. + // Mark player as zombie. bZombie[client] = true; // Remove all weapons and give a knife. RemoveAllPlayersWeapons(client); GivePlayerItem(client, "weapon_knife"); - ztele_count[client] = 0; // In use? - - // Terminate the round if the last player was infected. - new RoundEndOutcome:outcome; - if (RoundEndGetRoundStatus(outcome)) - { - RoundEndTerminateRound(outcome); - } - - // Switch the player to terrorists. - CS_SwitchTeam(client, CS_TEAM_T); - - // Check if consecutive infection protection is enabled. new bool:infectconsecutiveblock = GetConVarBool(g_hCvarsList[CVAR_INFECT_CONSECUTIVE_BLOCK]); @@ -297,10 +270,34 @@ InfectPlayer(client, attacker = -1, bool:motherinfect = false) ClassOnClientInfected(client, motherinfect); SEffectsOnClientInfected(client); ZHPOnClientInfected(client); - AbortTeleport(client); + TeleportOnClientInfected(client); // Apply effects. InfectionEffects(client); + + // Fire death event and set weapon info if the attacker is specified. + if (ZRIsValidClient(attacker)) + { + new Handle:event = CreateEvent("player_death"); + if (event != INVALID_HANDLE) + { + SetEventInt(event, "userid", GetClientUserId(client)); + SetEventInt(event, "attacker", GetClientUserId(attacker)); + SetEventString(event, "weapon", "zombie_claws_of_death"); + FireEvent(event, false); + } + } + + // Switch the player to terrorists. + // TODO: A solution to stop confusing bots? Respawn and teleport? + CS_SwitchTeam(client, CS_TEAM_T); + + // Terminate the round if the last player was infected. + new RoundEndOutcome:outcome; + if (RoundEndGetRoundStatus(outcome)) + { + RoundEndTerminateRound(outcome); + } } InfectionEffects(client) diff --git a/src/zr/zombiereloaded.inc b/src/zr/zombiereloaded.inc index 1b24018..6ef2719 100644 --- a/src/zr/zombiereloaded.inc +++ b/src/zr/zombiereloaded.inc @@ -43,17 +43,6 @@ new bool:bMotherInfectImmune[MAXPLAYERS + 1]; */ new Handle:tInfect = INVALID_HANDLE; -// TODO: MOVE TO TELEPORT MODULE. -new Float:spawnLoc[MAXPLAYERS + 1][3]; -new Float:bufferLoc[MAXPLAYERS + 1][3]; -new bool:ztele_spawned[MAXPLAYERS + 1] = {false, ...}; -new bool:bufferLocSaved[MAXPLAYERS + 1] = {false, ...}; -new ztele_countdown[MAXPLAYERS + 1] = {-1, ...}; -new ztele_count[MAXPLAYERS + 1]; -new bool:ztele_online = false; -new Handle:ztele_startup_timer = INVALID_HANDLE; -new Handle:ztele_countdown_timer[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; -new Handle:ztele_cooldown_timer[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; /** * Converts string of "yes" or "no" to a boolean value.