if(GetPlayerHealth(playerid) < 25.0 && GetPVarInt(playerid, "Under25HP") == 0)
{
ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1,1);
SetPVarInt(playerid, "Under25HP", 1);
}
else if(GetPVarInt(playerid, "Under25HP") == 1 && GetPlayerHealth(playerid) > 25.0)
{
ClearAnimations(playerid);
SetPVarInt(playerid, "Under25HP", 0);
}
|
ye if you place this under onplayerupdtate then itll work i think
|
new bool: WalkDrunk[MAX_PLAYERS];
public OnPlayerUpdate (playerid) {
new playerState = GetPlayerState(playerid), Float: playerHealth;
GetPlayerHealth (playerid, playerHealth);
if (playerState == PLAYER_STATE_ONFOOT) {
if (playerHealth <= 25 && !WalkDrunk[playerid]) {
WalkDrunk[playerid] = true;
ApplyAnimation (playerid, "PED", "WALK_DRUNK", 4.1, 1, 1, 1, 1, 1, 1);
} else if (playerHealth > 25 && WalkDrunk) {
WalkDrunk[playerid] = false;
ClearAnimations (playerid);
}
}
return 1;
}
need to work with onplayerstatechange