Wouldn't changing this line
SetEntProp(attacker, Prop_Send, "m_iHealth", hp);
to this:
if (GetAdminFlag(GetUserAdmin(
attacker), Admin_Custom2)) SetEntProp(attacker, Prop_Send, "m_iHealth", hp);
Sort your issue?
OR
Maybe put something like this after the
GetClientOfUserId line:
if (!GetAdminFlag(GetUserAdmin(
attacker), Admin_Custom2)) return;
Heres the code post fix:
Code:
public OnPluginStart()
{
HookEventEx("player_death", death);
}
public death(Handle:event, const String:name[], bool:dontBroadcast)
{
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
if(!GetAdminFlag(GetUserAdmin(attacker), Admin_Custom2)) return; //return if the attacker does not have custom2 admin flag.
if(attacker != 0 && IsClientInGame(attacker) && IsPlayerAlive(attacker))
{
new hp = GetClientHealth(attacker);
if(hp >= 150)
{
return;
}
new String:weapon[20];
GetEventString(event, "weapon", weapon, sizeof(weapon));
if(StrContains(weapon, "flashbang") != -1 || StrContains(weapon, "grenade") != -1 || StrContains(weapon, "knife") != -1)
{
hp += 15;
}
else
{
new victim = GetClientOfUserId(GetEventInt(event, "userid"));
if(CheckCommandAccess(victim, "sm_admin", ADMFLAG_GENERIC))
{
hp += 5;
}
else
{
hp += 5;
}
if(GetEventBool(event, "headshot"))
{
hp += 5;
}
}
if(hp > 150)
{
hp = 150;
}
SetEntProp(attacker, Prop_Send, "m_iHealth", hp);
}
}