Moved teleport variables into teleport.inc. Changed order of death event on infection. Known bug: Teamkill on last zombie kill.
This commit is contained in:
parent
0f15efaa85
commit
0bf074bf7a
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user