//top of your script
forward CheckPlayerHealth(playerid);
forward PlayerIsGoingToDie(playerid);
forward StopAnimation(playerid);
//UnderOnPlayerSpawn
SetTimerEx("CheckPlayerHealth",10000,1,"i",playerid);
//Bottom of the script, outside all functions
public CheckPlayerHealth(playerid){
new Float:Health;
GetPlayerHealth(playerid,Health);
if (Health >= 20){PlayerIsGoingToDie(playerid);}
}
public PlayerIsGoingToDie(playerid){
SetPlayerHealth(playerid,1);
TogglePlayerControllable(playerid,0);
ApplyAnimation(playerid,"SWEET","Sweet_injuredloop",4.1,1,1,1,1,1);
SetTimerEx("StopAnimation",10000,0,"i",playerid);
}
public StopAnimation(playerid){
ClearAnimations(playerid);
TogglePlayerControllable(playerid,1);
SetPlayerHealth(playerid,0);
}