Quote:
Originally Posted by Mini_Midget
yes it is the same but I'm not sure if damage can be a float or not so I just made it into a float then rounded it up to a integer
|
That makes no sense at all. Neither does your code.
Now, try to explain, what is the ammount to give to who and we will be able to fix it.
bcas current_hp + current_hp + damage = new life? makes no sense.
If attacker has 70 hp and damage 35 it would be 70 + 70 + 35 = 175.
And on top of that, that gives the player who gets damaged extra life. This means no one would be able to kill anyone unless damage > 100.
This gives attacker +(damage/3) to life
so if attacker does 140 damage he gets 46 hp:
Code:
public event_damage_lifesteal(id) {
new damage = read_data(2)
new attacker = get_user_attacker(id)
if ( ! is_user_alive(id) || ! is_user_connected(id) )
return PLUGIN_CONTINUE
new current_hp = get_user_health(attacker)
new max_hp = get_pcvar_num(zomb_hp)
current_hp += damage / 3
if ( g_zombie[attacker] ) {
if ( current_hp >= max_hp )
set_user_health(attacker, max_hp)
else
set_user_health(attacker, current_hp)
}
return PLUGIN_CONTINUE
}