Quote:
Originally Posted by iskenderkebab33
|
thx, I had forgotten to hook the player death.
Now I can detect when the victim dies, but instead of giving +10HP it is giving +30, +40...
Code:
public OnClientPutInServer(client)
{
HookEvent("player_death", OnPlayerDeath);
}
public Action OnPlayerDeath(Handle event, char[] name, bool dontBroadcast)
{
int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
if (CheckCommandAccess(attacker, "", ADMFLAG_NEEDED, true))
{
int health = GetEntProp(attacker, Prop_Send, "m_iHealth");
PrintToConsole(attacker, "Health: %i", health);
health = health + 10;
SetEntityHealth(attacker, health);
if(health > 150)
{
SetEntityHealth(attacker, 150);
}
}
return Plugin_Continue;
}
When I print the health int to console I get
Code:
Health: 100
Health: 110
Health: 120
I think it is giving +10HP per player in the server, but I'm not sure why...