22.06.2011, 05:16
Alright, so I've made a system where if someone hits something while driving, and their vehicle takes damage, then they take a portion of damage too. However, I'm having some trouble with this. When the person's health gets to 0/-999.9, they don't properly die. Can someone please tell me how I can ensure they die.
Here's a snippet of relevant code
Here's a snippet of relevant code
pawn Код:
if(damageAmount > 0.0)
{
new Float:tmpFloat;
GetPlayerHealth(i, tmpFloat);
SetPlayerHealth(i, floatsub(tmpFloat, damageAmount));
if((tmpFloat - damageAmount) <= 0.0) SetPlayerHealth(i, -999.99);
else SetPlayerHealth(i, floatsub(tmpFloat, damageAmount));
}