ZombieManager: fix ZombieShield for nukes and such

+ typo
This commit is contained in:
dogan 2020-08-06 02:59:14 +02:00
parent c3c09f395d
commit 5db56330d6

View File

@ -49,7 +49,7 @@ 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);
HookConVarChange((cvar = CreateConVar("sm_zombieshield", "1", "1 = Zombie Shield activated, 0 = Zombie Shield deactivated", FCVAR_NONE, true, 0.0, true, 1.0)), Cvar_ZombieShield);
g_bShield = cvar.BoolValue;
delete cvar;
@ -259,12 +259,13 @@ public Action OnPlayerTeam(Event event, const char[] name, bool dontBroadcast)
public Action OnPlayerHurt(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
int damage = GetEventInt(event, "dmg_health");
if(!IsClientInGame(client) || !IsPlayerAlive(client) || !ZR_IsClientZombie(client))
return Plugin_Continue;
if(g_iZShield[client] > 0)
if(g_iZShield[client] > 0 && attacker != 0)
{
g_iZShield[client] = g_iZShield[client] - damage;
SetEntityHealth(client, g_iZHPMax[client]);