10.01.2015, 22:27
(
Последний раз редактировалось bigboy81; 11.01.2015 в 01:50.
)
FIXED
new Float:health;
GetPlayerHealth(playerid,health);
if(health >= 29)
{
ClearAnimations(playerid);
TogglePlayerControllable(playerid, 1);
}
else if(health <= 29)
{
TogglePlayerControllable(playerid, 0);
LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
}
Please dont judge me guys, I maybe dont know what I am talking about but in my head this popped up.
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);
}
new lowhealth[MAX_PLAYERS];
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 Код:
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] = 0; // 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] = 1; // Will set the "lowhealth" variable to 0, so that it wont repeatedly unfreeze the player and clear his animations ClearAnimations(playerid); TogglePlayerControllable(playerid, 1); }