Quote:
Originally Posted by CalvinC
Oh yeah nvm im stupid.
What you're doing is, unfreezing and removing all animations/actions from the player every time the player updates. (around 30 ms)
Replace with this:
pawn Код:
new Float:health; GetPlayerHealth(playerid,health); if(health <= 29 && lowhealth[playerid] == 0) // Will now detect if "lowhealth" variable is set to 0 AND the health is lower than 30 { lowhealth[playerid] = 1; // Will set the "lowhealth" variable to 1, so that it wont repeatedly set the player in Crack animation and freeze him TogglePlayerControllable(playerid, 0); LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); } else if(health > 29 && lowhealth[playerid] == 1) // Will now detect if "lowhealth" variable is set to 1 AND health is higher than 29, also removed the " = " since it would make him both freeze and unfreeze if player had 29 health { lowhealth[playerid] = 0; // Will set the "lowhealth" variable to 0, so that it wont repeatedly unfreeze the player and clear his animations ClearAnimations(playerid); TogglePlayerControllable(playerid, 1); }
And put this at the top of your script underneath your includes:
pawn Код:
new lowhealth[MAX_PLAYERS];
Which will create the "lowhealth" variable.
|
Now works,but the only problem in this is when player click right mouse he stand up