Thread: FlashProtect
View Single Post
vilaemail
Member
Join Date: Jan 2009
Location: Tu i tamo, svuda pomalo
Old 01-19-2010 , 14:58   Re: FlashProtect
Reply With Quote #21

Hi! There is a bug in your code.

If for example I have 10hp and I flash team mates (but min health is set to 20), instead of leaving me to 10hp i get "healed" to 20hp. So basically you are calling slap with a negative number which equals in "healing". To solve change your code to:

Code:
if (minHealth > 0 && health - damage < minHealth)
    {
        if (health - minHealth > 0)
        {
            SlapPlayer(client, health - minHealth);
        }
    }
    else
    {
        if (damage >= health)
        {
            ForcePlayerSuicide(client);
        }
        else
        {
            SlapPlayer(client, damage);
        }
}
vilaemail is offline