I found strange bug when you are at the top of enemy hull and are hitting the enemy, ham fires 2 events.
PHP Code:
public plugin_init()
{
RegisterHam(Ham_TakeDamage, "player", "ham_takedamage", 1);
}
public ham_takedamage(victim, inflictor, attacker, Float:f_damage, damage_bits)
{
server_print("[%f] attacker: %d, victim: %d, inflictor: %d, \
weapon: %d, damage: %d, hp_left: %d",
get_gametime(), attacker, victim, inflictor, weapon, damage,
get_user_health(victim));
}
I got these messages in the terminal:
PHP Code:
[30.316444] attacker: 2, victim: 4, inflictor: 2, weapon: 26, damage: 39, hp_left: 61
[30.316444] attacker: 2, victim: 4, inflictor: 2, weapon: 26, damage: 67, hp_left: 33
When I am shooting at front of the enemy like we do in usual, all works as expected. Is there any workaround I can use to eliminate this bug? The only idea that comes to my mind is delay this message for the next frame, but unfortunately I need this code in a library that I will use in my plugins and wrong timing (i.e. frame) may be undesirable.