ZombieManager: add convar for cancer maps like paranoid

This commit is contained in:
dogan 2020-08-05 18:29:35 +02:00
parent 2c0f31077c
commit c3c09f395d

View File

@ -16,6 +16,7 @@ bool g_bZHP[MAXPLAYERS + 1] = { false, ... };
Handle g_hCookieZHP = null;
int g_iZHPMax[MAXPLAYERS + 1];
int g_iZShield[MAXPLAYERS + 1];
bool g_bShield;
bool g_Plugin_entWatch;
@ -48,6 +49,8 @@ public void OnPluginStart()
ConVar cvar;
HookConVarChange((cvar = CreateConVar("sm_player_afk_time", "120", "AFK Time in seconds after which a player won't turn into a motherzombie")), Cvar_AFKTime);
g_iAFKTime = cvar.IntValue;
HookConVarChange((cvar = CreateConVar("sm_zombieshield", "1", "1 = Zombie Shield activated, 0 = Zombie Shield disactivated", FCVAR_NONE, true, 0.0, true, 1.0)), Cvar_ZombieShield);
g_bShield = cvar.BoolValue;
delete cvar;
RegConsoleCmd("sm_zhp", OnToggleZHP, "Toggle blocking Zombie HP and Shield display");
@ -175,6 +178,11 @@ public void Cvar_AFKTime(ConVar convar, const char[] oldValue, const char[] newV
g_iAFKTime = convar.IntValue;
}
public void Cvar_ZombieShield(ConVar convar, const char[] oldValue, const char[] newValue)
{
g_bShield = convar.BoolValue;
}
public void OnRoundStart(Event hEvent, const char[] sName, bool bDontBroadcast)
{
g_bTestRound = false;
@ -401,10 +409,12 @@ public Action Timer_HandleHPShield(Handle timer)
bHasItem = EW_ClientHasItem(i);
#endif
if(bHasItem)
if(!g_bShield)
g_iZShield[i] = 0; //disabled by convar
else if(bHasItem)
g_iZShield[i] = 0; //zombies with items
else if(GetClientHealth(i) >= g_iZHPMax[i] && bNemesis)
g_iZShield[i] = 0; //disable for now on nemesis
g_iZShield[i] = 0; //disabled for now on nemesis
//g_iZShield[i] = g_iZShield[i] + 12; // health_regen_amount = 12
else if(GetClientHealth(i) >= g_iZHPMax[i] && !bNemesis)
g_iZShield[i] = g_iZShield[i] + 6; // health_regen_amount = 6