Moved ZHP to its own module, plugin now uses InfectPlayer.
This commit is contained in:
parent
37dfea2f8c
commit
75e654992c
@ -1,7 +1,7 @@
|
|||||||
"Phrases"
|
"Phrases"
|
||||||
{
|
{
|
||||||
// ===========================
|
// ===========================
|
||||||
// Chat Messages
|
// General
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
"Round objective"
|
"Round objective"
|
||||||
@ -77,19 +77,6 @@
|
|||||||
"en" "Switched zombie class to \"{1}\""
|
"en" "Switched zombie class to \"{1}\""
|
||||||
"ru" "Класс зомби переключен на \"{1}\""
|
"ru" "Класс зомби переключен на \"{1}\""
|
||||||
}
|
}
|
||||||
|
|
||||||
"Spawn protection begin"
|
|
||||||
{
|
|
||||||
"#format" "{1:d}"
|
|
||||||
"en" "Zombies are present, you have {1} seconds to find a safe place before you lose immunity."
|
|
||||||
"ru" "Зомби на свободе, у вас {1} секунд, чтобы найти безопасное место, пока не потеряли иммунитет."
|
|
||||||
}
|
|
||||||
|
|
||||||
"Spawn protection end"
|
|
||||||
{
|
|
||||||
"en" "You are now susceptible to zombie infection."
|
|
||||||
"ru" "Теперь вы восприимчивы к зомби инфекции."
|
|
||||||
}
|
|
||||||
|
|
||||||
"!ztele amount"
|
"!ztele amount"
|
||||||
{
|
{
|
||||||
@ -152,18 +139,6 @@
|
|||||||
"en" "Teleport successful."
|
"en" "Teleport successful."
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zhp enabled"
|
|
||||||
{
|
|
||||||
"en" "HP display enabled, your real HP will be displayed persistently after infection."
|
|
||||||
"ru" "Отображение здоровья включено, ваше реальное здоровье будет показано после инфицирования."
|
|
||||||
}
|
|
||||||
|
|
||||||
"!zhp disabled"
|
|
||||||
{
|
|
||||||
"en" "HP display disabled."
|
|
||||||
"ru" "Отображение здоровья включено."
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Generic
|
// Generic
|
||||||
// ===========================
|
// ===========================
|
||||||
@ -317,6 +292,60 @@
|
|||||||
"en" "Unrestrict All Group Weapons"
|
"en" "Unrestrict All Group Weapons"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===========================
|
||||||
|
// Spawn Protect
|
||||||
|
// ===========================
|
||||||
|
|
||||||
|
// General
|
||||||
|
|
||||||
|
"Spawn protection begin"
|
||||||
|
{
|
||||||
|
"#format" "{1:d}"
|
||||||
|
"en" "Zombies are present, you have {1} seconds to find a safe place before you lose immunity."
|
||||||
|
"ru" "Зомби на свободе, у вас {1} секунд, чтобы найти безопасное место, пока не потеряли иммунитет."
|
||||||
|
}
|
||||||
|
|
||||||
|
"Spawn protection end"
|
||||||
|
{
|
||||||
|
"en" "You are now susceptible to zombie infection."
|
||||||
|
"ru" "Теперь вы восприимчивы к зомби инфекции."
|
||||||
|
}
|
||||||
|
|
||||||
|
// HUD
|
||||||
|
|
||||||
|
"Spawn Protect"
|
||||||
|
{
|
||||||
|
"#format" "{1:d}"
|
||||||
|
"en" "Zombie protection ends in: {1} seconds."
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================
|
||||||
|
// ZHP
|
||||||
|
// ===========================
|
||||||
|
|
||||||
|
// General
|
||||||
|
|
||||||
|
"ZHP enable"
|
||||||
|
{
|
||||||
|
"en" "HP display enabled, your real HP will be displayed after infection."
|
||||||
|
}
|
||||||
|
|
||||||
|
"ZHP disable"
|
||||||
|
{
|
||||||
|
"en" "HP display disabled."
|
||||||
|
"ru" "Отображение здоровья включено."
|
||||||
|
}
|
||||||
|
|
||||||
|
// HUD
|
||||||
|
|
||||||
|
"Display HP"
|
||||||
|
{
|
||||||
|
"#format" "{1:d}"
|
||||||
|
"en" "HP: {1}"
|
||||||
|
"ru" "Здоровье: {1}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
"Suicide text"
|
"Suicide text"
|
||||||
{
|
{
|
||||||
"en" "Nice try n00b!"
|
"en" "Nice try n00b!"
|
||||||
@ -403,36 +432,36 @@
|
|||||||
"en" "Rebuy"
|
"en" "Rebuy"
|
||||||
"ru" "Купить снова"
|
"ru" "Купить снова"
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Class menu
|
// Class menu
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
"!zclass title"
|
"!zclass title"
|
||||||
{
|
{
|
||||||
"en" "Class Selection:"
|
"en" "Class Selection:"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zclass zombie"
|
"!zclass zombie"
|
||||||
{
|
{
|
||||||
"en" "Select Zombie Class"
|
"en" "Select Zombie Class"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zclass human"
|
"!zclass human"
|
||||||
{
|
{
|
||||||
"en" "Select Human Class"
|
"en" "Select Human Class"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zclass admin"
|
"!zclass admin"
|
||||||
{
|
{
|
||||||
"en" "Select Admin Class"
|
"en" "Select Admin Class"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zclass admin mode enabled"
|
"!zclass admin mode enabled"
|
||||||
{
|
{
|
||||||
"en" "Admin mode is enabled!"
|
"en" "Admin mode is enabled!"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zclass admin mode toggle"
|
"!zclass admin mode toggle"
|
||||||
{
|
{
|
||||||
"en" "Toggle Admin Mode"
|
"en" "Toggle Admin Mode"
|
||||||
@ -589,23 +618,6 @@
|
|||||||
"en" "Toggle Logging Flags:"
|
"en" "Toggle Logging Flags:"
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================
|
|
||||||
// HudHints
|
|
||||||
// ===========================
|
|
||||||
|
|
||||||
"Display HP"
|
|
||||||
{
|
|
||||||
"#format" "{1:d}"
|
|
||||||
"en" "HP: {1}"
|
|
||||||
"ru" "Здоровье: {1}"
|
|
||||||
}
|
|
||||||
|
|
||||||
"Spawn Protect"
|
|
||||||
{
|
|
||||||
"#format" "{1:d}"
|
|
||||||
"en" "Zombie protection ends in: {1} seconds."
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Server Messages
|
// Server Messages
|
||||||
// ===========================
|
// ===========================
|
||||||
|
@ -45,6 +45,9 @@
|
|||||||
// Spawn protect
|
// Spawn protect
|
||||||
#include "zr/spawnprotect"
|
#include "zr/spawnprotect"
|
||||||
|
|
||||||
|
// ZHP
|
||||||
|
#include "zr/zhp"
|
||||||
|
|
||||||
#include "zr/zadmin"
|
#include "zr/zadmin"
|
||||||
#include "zr/damagecontrol"
|
#include "zr/damagecontrol"
|
||||||
#include "zr/commands"
|
#include "zr/commands"
|
||||||
@ -173,12 +176,12 @@ public OnClientPutInServer(client)
|
|||||||
|
|
||||||
bZVision[client] = !IsFakeClient(client);
|
bZVision[client] = !IsFakeClient(client);
|
||||||
|
|
||||||
new bool:zhp = GetConVarBool(gCvars[CVAR_ZHP_DEFAULT]);
|
|
||||||
dispHP[client] = zhp;
|
|
||||||
|
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
WeaponsClientInit(client);
|
|
||||||
ClassClientInit(client);
|
ClassClientInit(client);
|
||||||
|
WeaponsClientInit(client);
|
||||||
|
SpawnProtectClientInit(client);
|
||||||
|
ZHPClientInit(client);
|
||||||
|
|
||||||
if (!IsFakeClient(client)) AmbienceStart(client);
|
if (!IsFakeClient(client)) AmbienceStart(client);
|
||||||
|
|
||||||
ClientHookAttack(client);
|
ClientHookAttack(client);
|
||||||
@ -199,8 +202,8 @@ public OnClientDisconnect(client)
|
|||||||
PlayerLeft(client);
|
PlayerLeft(client);
|
||||||
|
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
WeaponsOnClientDisconnect(client);
|
|
||||||
ClassOnClientDisconnect(client);
|
ClassOnClientDisconnect(client);
|
||||||
|
WeaponsOnClientDisconnect(client);
|
||||||
ZTeleResetClient(client);
|
ZTeleResetClient(client);
|
||||||
AmbienceStop(client);
|
AmbienceStop(client);
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public Action:Command_Infect(client, argc)
|
|||||||
|
|
||||||
for (new x = 0; x < tcount; x++)
|
for (new x = 0; x < tcount; x++)
|
||||||
{
|
{
|
||||||
Zombify(targets[x], 0);
|
InfectPlayer(targets[x]);
|
||||||
if (LogFlagCheck(LOG_GAME_EVENTS, LOG_MODULE_COMMANDS))
|
if (LogFlagCheck(LOG_GAME_EVENTS, LOG_MODULE_COMMANDS))
|
||||||
{
|
{
|
||||||
GetClientName(targets[x], target_name, sizeof(target_name));
|
GetClientName(targets[x], target_name, sizeof(target_name));
|
||||||
|
@ -232,7 +232,7 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
|
|||||||
// Check if spawn protection is disabled and the weapon is a knife.
|
// Check if spawn protection is disabled and the weapon is a knife.
|
||||||
if (!pProtect[index] && StrEqual(weapon, "knife"))
|
if (!pProtect[index] && StrEqual(weapon, "knife"))
|
||||||
{
|
{
|
||||||
Zombify(index, attacker);
|
InfectPlayer(index, attacker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
|
|||||||
|
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
ClassAlphaUpdate(index);
|
ClassAlphaUpdate(index);
|
||||||
UpdateHPDisplay(index);
|
ZHPOnPlayerHurt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
|
public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
|
||||||
@ -300,7 +300,8 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
|
|||||||
|
|
||||||
SetEntityHealth(attacker, health + healthgain);
|
SetEntityHealth(attacker, health + healthgain);
|
||||||
|
|
||||||
UpdateHPDisplay(attacker);
|
// Forward event to modules.
|
||||||
|
ZHPOnHealthInfectGain(attacker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -99,7 +99,10 @@ public MainMenuHandle(Handle:menu_main, MenuAction:action, client, slot)
|
|||||||
}
|
}
|
||||||
case 6:
|
case 6:
|
||||||
{
|
{
|
||||||
ZHP(client);
|
// Toggle ZHP.
|
||||||
|
ZHPToggle(client);
|
||||||
|
|
||||||
|
// Resend menu.
|
||||||
MainMenu(client);
|
MainMenu(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,8 @@ public Action:SayCommand(client, argc)
|
|||||||
|
|
||||||
else if (StrEqual(args, "!zhp", false))
|
else if (StrEqual(args, "!zhp", false))
|
||||||
{
|
{
|
||||||
ZHP(client);
|
// Toggle ZHP.
|
||||||
|
ZHPToggle(client);
|
||||||
}
|
}
|
||||||
else if (StrContains(args, "teleport", false) != -1
|
else if (StrContains(args, "teleport", false) != -1
|
||||||
|| StrContains(args, "stuck", false) != -1
|
|| StrContains(args, "stuck", false) != -1
|
||||||
@ -165,27 +166,4 @@ ZSpawn(client)
|
|||||||
RespawnPlayer(client);
|
RespawnPlayer(client);
|
||||||
|
|
||||||
AddPlayerToList(client);
|
AddPlayerToList(client);
|
||||||
}
|
|
||||||
|
|
||||||
ZHP(client)
|
|
||||||
{
|
|
||||||
new bool:zhp = GetConVarBool(gCvars[CVAR_ZHP]);
|
|
||||||
if (!zhp)
|
|
||||||
{
|
|
||||||
ZR_PrintToChat(client, "Feature is disabled");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dispHP[client])
|
|
||||||
{
|
|
||||||
ZR_PrintToChat(client, "!zhp disabled");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ZR_PrintToChat(client, "!zhp enabled");
|
|
||||||
UpdateHPDisplay(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
dispHP[client] = !dispHP[client];
|
|
||||||
}
|
}
|
@ -1,145 +1,146 @@
|
|||||||
/*
|
/*
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
*
|
*
|
||||||
* Zombie:Reloaded
|
* Zombie:Reloaded
|
||||||
*
|
*
|
||||||
* File: spawnprotect.inc
|
* File: spawnprotect.inc
|
||||||
* Description: Protects late-joining players from zombies for x seconds.
|
* Description: Protects late-joining players from zombies for x seconds.
|
||||||
*
|
*
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array for storing spawn protect timer handles per client.
|
* Array for storing spawn protect timer handles per client.
|
||||||
*/
|
*/
|
||||||
new Handle:tSpawnProtect[MAXPLAYERS + 1];
|
new Handle:tSpawnProtect[MAXPLAYERS + 1];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array for flagging client to be protected.
|
* Array for flagging client to be protected.
|
||||||
*/
|
*/
|
||||||
new bool:pSpawnProtect[MAXPLAYERS + 1];
|
new bool:pSpawnProtect[MAXPLAYERS + 1];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array for storing time left for spawn protection per client.
|
* Array for storing time left for spawn protection per client.
|
||||||
*/
|
*/
|
||||||
new pSpawnProtectTime[MAXPLAYERS + 1];
|
new pSpawnProtectTime[MAXPLAYERS + 1];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client is joining the server.
|
* Client is joining the server.
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
SpawnProtectClientInit(client)
|
SpawnProtectClientInit(client)
|
||||||
{
|
{
|
||||||
tSpawnProtect[client] = INVALID_HANDLE;
|
// Reset timer handle.
|
||||||
}
|
tSpawnProtect[client] = INVALID_HANDLE;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Player is spawning into the game.
|
/**
|
||||||
*
|
* Player is spawning into the game.
|
||||||
* @param client The client index.
|
*
|
||||||
*/
|
* @param client The client index.
|
||||||
SpawnProtectPlayerSpawn(client)
|
*/
|
||||||
{
|
SpawnProtectPlayerSpawn(client)
|
||||||
// Disable spawn protection on client.
|
{
|
||||||
pSpawnProtect[client] = false;
|
// Disable spawn protection on client.
|
||||||
|
pSpawnProtect[client] = false;
|
||||||
// If zombie hasn't spawned, then stop.
|
|
||||||
if (!zombieSpawned)
|
// If zombie hasn't spawned, then stop.
|
||||||
{
|
if (!zombieSpawned)
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
// If protect cvar is invalid or 0, then stop.
|
|
||||||
new protect = GetConVarInt(gCvars[CVAR_PROTECT]);
|
// If protect cvar is invalid or 0, then stop.
|
||||||
if (protect <= 0)
|
new protect = GetConVarInt(gCvars[CVAR_PROTECT]);
|
||||||
{
|
if (protect <= 0)
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
// Get respawn team.
|
|
||||||
decl String:respawnteam[32];
|
// Get respawn team.
|
||||||
GetConVarString(gCvars[CVAR_RESPAWN_TEAM], respawnteam, sizeof(respawnteam));
|
decl String:respawnteam[32];
|
||||||
|
GetConVarString(gCvars[CVAR_RESPAWN_TEAM], respawnteam, sizeof(respawnteam));
|
||||||
// If the respawn team is not set to zombie, and either cvar zr_suicide_world_damage or the client
|
|
||||||
// wasn't killed by world is false, then continue to protect client.
|
// If the respawn team is not set to zombie, and either cvar zr_suicide_world_damage or the client
|
||||||
if (!StrEqual(respawnteam, "zombie", false) && !(GetConVarBool(gCvars[CVAR_SUICIDE_WORLD_DAMAGE]) && gKilledByWorld[client]))
|
// wasn't killed by world is false, then continue to protect client.
|
||||||
{
|
if (!StrEqual(respawnteam, "zombie", false) && !(GetConVarBool(gCvars[CVAR_SUICIDE_WORLD_DAMAGE]) && gKilledByWorld[client]))
|
||||||
// Set spawn protect flag on client.
|
{
|
||||||
pSpawnProtect[client] = true;
|
// Set spawn protect flag on client.
|
||||||
|
pSpawnProtect[client] = true;
|
||||||
// Set improved attributes
|
|
||||||
// (Move to cvar?)
|
// Set improved attributes
|
||||||
SetPlayerAlpha(client, 0);
|
// (Move to cvar?)
|
||||||
SetPlayerSpeed(client, 600.0);
|
SetPlayerAlpha(client, 0);
|
||||||
|
SetPlayerSpeed(client, 600.0);
|
||||||
// Set time left to zr_protect's value.
|
|
||||||
pSpawnProtectTime[client] = protect;
|
// Set time left to zr_protect's value.
|
||||||
|
pSpawnProtectTime[client] = protect;
|
||||||
// Tell client they are being protected.
|
|
||||||
ZR_PrintToChat(client, "Spawn protection begin", protect);
|
// Tell client they are being protected.
|
||||||
|
ZR_PrintToChat(client, "Spawn protection begin", protect);
|
||||||
// Send time left in a hud message.
|
|
||||||
ZR_HudHint(client, "Spawn Protect", pSpawnProtectTime[client]);
|
// Send time left in a hud message.
|
||||||
|
ZR_HudHint(client, "Spawn Protect", pSpawnProtectTime[client]);
|
||||||
// If timer is currently running, kill it.
|
|
||||||
if (tSpawnProtect[client] != INVALID_HANDLE)
|
// If timer is currently running, kill it.
|
||||||
{
|
if (tSpawnProtect[client] != INVALID_HANDLE)
|
||||||
KillTimer(tSpawnProtect[client]);
|
{
|
||||||
}
|
KillTimer(tSpawnProtect[client]);
|
||||||
|
}
|
||||||
// Start repeating timer.
|
|
||||||
tSpawnProtect[client] = CreateTimer(1.0, SpawnProtectTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
// Start repeating timer.
|
||||||
}
|
tSpawnProtect[client] = CreateTimer(1.0, SpawnProtectTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Timer callback function, countdown for spawn protection.
|
/**
|
||||||
*
|
* Timer callback function, countdown for spawn protection.
|
||||||
* @param timer The timer handle.
|
*
|
||||||
* @param client The client index.
|
* @param timer The timer handle.
|
||||||
*/
|
* @param client The client index.
|
||||||
public Action:SpawnProtectTimer(Handle:timer, any:client)
|
*/
|
||||||
{
|
public Action:SpawnProtectTimer(Handle:timer, any:client)
|
||||||
// If client leaves, then stop timer.
|
{
|
||||||
if (!IsClientInGame(client))
|
// If client leaves, then stop timer.
|
||||||
{
|
if (!IsClientInGame(client))
|
||||||
return Plugin_Stop;
|
{
|
||||||
}
|
return Plugin_Stop;
|
||||||
|
}
|
||||||
// If client has become a zombie, then stop timer.
|
|
||||||
if (!IsPlayerHuman(client))
|
// If client has become a zombie, then stop timer.
|
||||||
{
|
if (!IsPlayerHuman(client))
|
||||||
return Plugin_Stop;
|
{
|
||||||
}
|
return Plugin_Stop;
|
||||||
|
}
|
||||||
// Decrement time left.
|
|
||||||
pSpawnProtectTime[client]--;
|
// Decrement time left.
|
||||||
|
pSpawnProtectTime[client]--;
|
||||||
// Print time left to client.
|
|
||||||
ZR_HudHint(client, "Spawn Protect", pSpawnProtectTime[client]);
|
// Print time left to client.
|
||||||
|
ZR_HudHint(client, "Spawn Protect", pSpawnProtectTime[client]);
|
||||||
// Time has expired.
|
|
||||||
if (pSpawnProtectTime[client] <= 0)
|
// Time has expired.
|
||||||
{
|
if (pSpawnProtectTime[client] <= 0)
|
||||||
// Remove protect flag.
|
{
|
||||||
pSpawnProtect[client] = false;
|
// Remove protect flag.
|
||||||
|
pSpawnProtect[client] = false;
|
||||||
// Tell client spawn protection is over.
|
|
||||||
ZR_HudHint(client, "Spawn protection end");
|
// Tell client spawn protection is over.
|
||||||
|
ZR_HudHint(client, "Spawn protection end");
|
||||||
// Fix attributes.
|
|
||||||
// TODO: Set class attributes.
|
// Fix attributes.
|
||||||
SetPlayerAlpha(client, 255);
|
// TODO: Set class attributes.
|
||||||
SetPlayerSpeed(client, 300.0);
|
SetPlayerAlpha(client, 255);
|
||||||
|
SetPlayerSpeed(client, 300.0);
|
||||||
// Clear timer handle.
|
|
||||||
tSpawnProtect[client] = INVALID_HANDLE;
|
// Clear timer handle.
|
||||||
|
tSpawnProtect[client] = INVALID_HANDLE;
|
||||||
// Stop timer.
|
|
||||||
return Plugin_Stop;
|
// Stop timer.
|
||||||
}
|
return Plugin_Stop;
|
||||||
|
}
|
||||||
// Allow timer to continue repeating.
|
|
||||||
return Plugin_Continue;
|
// Allow timer to continue repeating.
|
||||||
|
return Plugin_Continue;
|
||||||
}
|
}
|
@ -397,7 +397,7 @@ public ZRInfectHandle(Handle:menu_infect, MenuAction:action, client, slot)
|
|||||||
{
|
{
|
||||||
decl String:name[64];
|
decl String:name[64];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
Zombify(target, 0);
|
InfectPlayer(target);
|
||||||
ShowActivity2(client, "[ZR] ", "Infected %s", name);
|
ShowActivity2(client, "[ZR] ", "Infected %s", name);
|
||||||
ZRInfectMenu(client);
|
ZRInfectMenu(client);
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ public Action:MotherZombie(Handle:timer)
|
|||||||
randclient = RandomPlayerFromList();
|
randclient = RandomPlayerFromList();
|
||||||
} while (!IsPlayerAlive(randclient) || gBlockMotherInfect[randclient]);
|
} while (!IsPlayerAlive(randclient) || gBlockMotherInfect[randclient]);
|
||||||
|
|
||||||
Zombify_Mother(randclient);
|
InfectPlayer(randclient, _, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -151,7 +151,7 @@ public Action:MotherZombie(Handle:timer)
|
|||||||
randclient = RandomPlayerFromList();
|
randclient = RandomPlayerFromList();
|
||||||
} while (IsPlayerZombie(randclient) || !IsPlayerAlive(randclient) || gBlockMotherInfect[randclient]);
|
} while (IsPlayerZombie(randclient) || !IsPlayerAlive(randclient) || gBlockMotherInfect[randclient]);
|
||||||
|
|
||||||
Zombify_Mother(randclient);
|
InfectPlayer(randclient, _, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ public Action:MotherZombie(Handle:timer)
|
|||||||
zombieSpawned = true;
|
zombieSpawned = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Zombify_Mother(client)
|
/*Zombify_Mother(client)
|
||||||
{
|
{
|
||||||
gZombie[client] = true;
|
gZombie[client] = true;
|
||||||
motherZombie[client] = true;
|
motherZombie[client] = true;
|
||||||
@ -193,21 +193,7 @@ Zombify_Mother(client)
|
|||||||
}
|
}
|
||||||
tHandles[client][TMOAN] = CreateTimer(interval, ZombieMoanTimer, client, TIMER_REPEAT);
|
tHandles[client][TMOAN] = CreateTimer(interval, ZombieMoanTimer, client, TIMER_REPEAT);
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
if (tHandles[client][TZHP] != INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
KillTimer(tHandles[client][TZHP]);
|
|
||||||
tHandles[client][TZHP] = INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
new bool:zhp = GetConVarBool(gCvars[CVAR_ZHP]);
|
|
||||||
if (zhp)
|
|
||||||
{
|
|
||||||
UpdateHPDisplay(client);
|
|
||||||
|
|
||||||
tHandles[client][TZHP] = CreateTimer(5.0, ZHPTimer, client, TIMER_REPEAT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zombifies a player. Execute events, sets attributes and flags that indicate
|
* Zombifies a player. Execute events, sets attributes and flags that indicate
|
||||||
@ -217,7 +203,7 @@ Zombify_Mother(client)
|
|||||||
* @param attacker Optional. The attacker who did the infect.
|
* @param attacker Optional. The attacker who did the infect.
|
||||||
* @param motherinfect Optional. Indicates a mother zombie infect.
|
* @param motherinfect Optional. Indicates a mother zombie infect.
|
||||||
*/
|
*/
|
||||||
Zombify(client, attacker = -1, bool:motherinfect = false)
|
InfectPlayer(client, attacker = -1, bool:motherinfect = false)
|
||||||
{
|
{
|
||||||
// Check if the attacker was specified.
|
// Check if the attacker was specified.
|
||||||
if (attacker > 0)
|
if (attacker > 0)
|
||||||
@ -262,23 +248,9 @@ Zombify(client, attacker = -1, bool:motherinfect = false)
|
|||||||
tHandles[client][TMOAN] = CreateTimer(interval, ZombieMoanTimer, client, TIMER_REPEAT);
|
tHandles[client][TMOAN] = CreateTimer(interval, ZombieMoanTimer, client, TIMER_REPEAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kill HP display timer.
|
|
||||||
if (tHandles[client][TZHP] != INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
KillTimer(tHandles[client][TZHP]);
|
|
||||||
tHandles[client][TZHP] = INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start HP display if enabled.
|
|
||||||
new bool:zhp = GetConVarBool(gCvars[CVAR_ZHP]);
|
|
||||||
if (zhp)
|
|
||||||
{
|
|
||||||
UpdateHPDisplay(client);
|
|
||||||
tHandles[client][TZHP] = CreateTimer(5.0, ZHPTimer, client, TIMER_REPEAT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
ClassOnClientInfected(client);
|
ClassOnClientInfected(client, motherinfect);
|
||||||
|
ZHPOnClientInfected(client);
|
||||||
AbortTeleport(client);
|
AbortTeleport(client);
|
||||||
|
|
||||||
// Apply effects.
|
// Apply effects.
|
||||||
@ -425,7 +397,7 @@ PlayerLeft(client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
new randclient = GetArrayCell(aClients, GetRandomInt(0, size-1));
|
new randclient = GetArrayCell(aClients, GetRandomInt(0, size-1));
|
||||||
Zombify_Mother(randclient);
|
InfectPlayer(randclient, _, true);
|
||||||
|
|
||||||
ZR_PrintToChat(randclient, "Zombie replacement");
|
ZR_PrintToChat(randclient, "Zombie replacement");
|
||||||
|
|
||||||
@ -582,42 +554,6 @@ public Action:ZombieMoanTimer(Handle:timer, any:index)
|
|||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateHPDisplay(client)
|
|
||||||
{
|
|
||||||
new bool:zhp = GetConVarBool(gCvars[CVAR_ZHP]);
|
|
||||||
if (!zhp)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsPlayerZombie(client) || !dispHP[client])
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
new health = GetClientHealth(client);
|
|
||||||
if (health < 0)
|
|
||||||
{
|
|
||||||
health = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZR_HudHint(client, "Display HP", health);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action:ZHPTimer(Handle:timer, any:index)
|
|
||||||
{
|
|
||||||
if (!IsClientInGame(index))
|
|
||||||
{
|
|
||||||
tHandles[index][TZHP] = INVALID_HANDLE;
|
|
||||||
|
|
||||||
return Plugin_Stop;
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateHPDisplay(index);
|
|
||||||
|
|
||||||
return Plugin_Continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
RespawnPlayer(client)
|
RespawnPlayer(client)
|
||||||
{
|
{
|
||||||
if (!IsClientInGame(client))
|
if (!IsClientInGame(client))
|
||||||
@ -637,13 +573,13 @@ RespawnPlayer(client)
|
|||||||
|
|
||||||
if (StrEqual(team, "zombie", false))
|
if (StrEqual(team, "zombie", false))
|
||||||
{
|
{
|
||||||
Zombify(client, 0);
|
InfectPlayer(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetConVarBool(gCvars[CVAR_SUICIDE_WORLD_DAMAGE]) && gKilledByWorld[client])
|
if (GetConVarBool(gCvars[CVAR_SUICIDE_WORLD_DAMAGE]) && gKilledByWorld[client])
|
||||||
{
|
{
|
||||||
Zombify(client, 0);
|
InfectPlayer(client);
|
||||||
gKilledByWorld[client] = false;
|
gKilledByWorld[client] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,6 @@ new bool:gBlockMotherInfect[MAXPLAYERS + 1];
|
|||||||
new bool:bZVision[MAXPLAYERS + 1];
|
new bool:bZVision[MAXPLAYERS + 1];
|
||||||
//new bool:bZVisionOn[MAXPLAYERS + 1];
|
//new bool:bZVisionOn[MAXPLAYERS + 1];
|
||||||
//new String:ZVisionOverlay[MAXPLAYERS + 1][PLATFORM_MAX_PATH];
|
//new String:ZVisionOverlay[MAXPLAYERS + 1][PLATFORM_MAX_PATH];
|
||||||
new bool:dispHP[MAXPLAYERS + 1];
|
|
||||||
new bool:pProtect[MAXPLAYERS + 1];
|
new bool:pProtect[MAXPLAYERS + 1];
|
||||||
new bool:gKilledByWorld[MAXPLAYERS + 1] = {false, ...};
|
new bool:gKilledByWorld[MAXPLAYERS + 1] = {false, ...};
|
||||||
|
|
||||||
@ -95,14 +94,13 @@ new Handle:tInfect = INVALID_HANDLE;
|
|||||||
|
|
||||||
new Handle:pList = INVALID_HANDLE;
|
new Handle:pList = INVALID_HANDLE;
|
||||||
|
|
||||||
#define MAXTIMERS 6
|
#define MAXTIMERS 5
|
||||||
|
|
||||||
#define TMOAN 0
|
#define TMOAN 0
|
||||||
#define TREGEN 1
|
#define TREGEN 1
|
||||||
#define TTELE 2
|
#define TTELE 2
|
||||||
#define TZHP 3
|
#define TRESPAWN 3
|
||||||
#define TRESPAWN 4
|
#define TZVISION 4
|
||||||
#define TZVISION 5
|
|
||||||
|
|
||||||
new Handle:tHandles[MAXPLAYERS + 1][MAXTIMERS];
|
new Handle:tHandles[MAXPLAYERS + 1][MAXTIMERS];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user