I have this code:
PHP Code:
public hook_death()
{
// Killer id
nKiller = read_data(1)
if(is_user_alive(nKiller))
{
if ( (read_data(3) == 1) && (read_data(5) == 0) )
{
nHp_add = get_pcvar_num (health_hs_add)
}
else
nHp_add = get_pcvar_num (health_add)
nHp_max = get_pcvar_num (health_max)
// Updating Killer HP
if(!(get_user_flags(nKiller) & ADMIN_LEVEL_H))
return;
nKiller_hp = get_user_health(nKiller)
nKiller_hp += nHp_add
// Maximum HP check
if (nKiller_hp > nHp_max) nKiller_hp = nHp_max
set_user_health(nKiller, nKiller_hp)
// Hud message "Healed +15/+30 hp"
if(nKiller_hp < nHp_max)
{
set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1)
show_hudmessage(nKiller, "Healed +%d hp", nHp_add)
}
// Screen fading
if(!is_user_flashed(nKiller)) //Checks if user is not flashed
{
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, nKiller)
write_short(1<<10)
write_short(1<<10)
write_short(0x0000)
write_byte(0)
write_byte(0)
write_byte(200)
write_byte(75)
message_end()
}
}
}
And when hud message is sent, f.e. if you have 90 hp (maximum is 100) and you kill someone it still shows that you got 15 HP, but you got only 10... (30hp if kill with head shot). So... I can't figure out how should I do that.
I am thinking of getting user health, then adding nHp_add and - 100? But I believe that I might get lots of errors... If someone can do it, please do it