09.01.2012, 06:16
Lol that's so prone to bugs.
Just create a variable:
Reset it in OnPlayerConnect (so there's no issues between new players joining with old in-use ID's)
Finally, in your OnPlayerUpdate:
When you want him to stand up again, just clear animations, set his HP to above 50 and set IsPlayerDowned[playerid] to false.
Just create a variable:
pawn Код:
new bool:IsPlayerDowned[MAX_PLAYERS];
pawn Код:
IsPlayerDowned[playerid] = false;
pawn Код:
public OnPlayerUpdate(playerid)
{
new Float:phealth;
GetPlayerHealth(playerid,phealth);
if(phealth <= 50 && IsPlayerDowned[playerid] = false)
{
//apply the fall animation
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid,-1,"You have falled to the ground because you are injured");
IsPlayerDowned[playerid] = true;
}
return 1;
}