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"
|
||||||
@ -78,19 +78,6 @@
|
|||||||
"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"
|
||||||
{
|
{
|
||||||
"#format" "{1:d}"
|
"#format" "{1:d}"
|
||||||
@ -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!"
|
||||||
@ -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
|
||||||
@ -166,26 +167,3 @@ ZSpawn(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];
|
|
||||||
}
|
|
@ -31,6 +31,7 @@ new pSpawnProtectTime[MAXPLAYERS + 1];
|
|||||||
*/
|
*/
|
||||||
SpawnProtectClientInit(client)
|
SpawnProtectClientInit(client)
|
||||||
{
|
{
|
||||||
|
// Reset timer handle.
|
||||||
tSpawnProtect[client] = INVALID_HANDLE;
|
tSpawnProtect[client] = INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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