28.11.2014, 15:57
Just remove the first
LOWHP[playerid] = 0;
You force it to become 0 everytime OnPlayerUpdate is called, and therefore it to execute the animation.
After the animation, you set it to 1, which is ok, but the next time it's forced back to 0 again, running the animation again.
You can also remove the second if-statement because it's never executed.
If the LOWHP is 0, you execute the first if-statement and exit the callback using the "return 1;".
This should work.
LOWHP[playerid] = 0;
You force it to become 0 everytime OnPlayerUpdate is called, and therefore it to execute the animation.
After the animation, you set it to 1, which is ok, but the next time it's forced back to 0 again, running the animation again.
You can also remove the second if-statement because it's never executed.
If the LOWHP is 0, you execute the first if-statement and exit the callback using the "return 1;".
pawn Код:
new Float:Health;
GetPlayerHealth(playerid, Health);
if (Health <= 20.0)
{
if(LOWHP[playerid] == 0)
{
ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die",9.1,0,1,1,1,1);
LOWHP[playerid] = 1;
}
}
else
LOWHP[playerid] = 0;
return 1;