Use the functions from the fun module instead.
They are much faster.
PHP Code:
public Ham_CBasePlayer_TakeDamage_Post(id, pevInflictor, pevAttacker, Float:flDamage, bitsDamageType)
{
if(IsPlayer(pevAttacker) && is_user_connected(pevAttacker) && HasUserMirror(id) && id != pevAttacker)
{
// removed unnecessary forced float tag for flDamage
// changed to get_pcvar_float()
new Float:damage_done = flDamage / get_pcvar_float(md_hp_division)
// float() for get_user_health() since it returns integer
// removed unnecessary forced float tag for damage_done
new Float:HP = float(get_user_health(pevAttacker)) - damage_done
// removed unnecessary forced float tag for HP
if(HP > 5.0)
{
// changed to set_user_health()
// redundant fm_get_user_health() calculation since HP variable contains that same calculation
set_user_health(pevAttacker, floatround(HP))
fade_red(pevAttacker, get_pcvar_num(md_fade_amount))
}
}
}
Since this is a POST hook, you are hooking after the damage is already done to the player.
Therefore, you will be doing damage twice to the player.
You should hook this as a PRE hook and change the damage parameter.
Then you should hook it as POST and check if remaining health of the player is more than 5.
__________________