|
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
|
07-22-2019
, 07:10
Re: [CS:GO] trying to give heath per kill
|
#4
|
Quote:
Originally Posted by JoaoRodrigoGamer
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...
|
Console output looks fine to me
Where do you see +30 +40?
__________________
|
|
|
|