autocrack when player have under 29 hp
#8

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
Reply


Messages In This Thread
autocrack when player have under 29 hp - by bigboy81 - 10.01.2015, 22:27
Re: autocrack when player have under 29 hp - by DavidSparks - 10.01.2015, 22:30
Re: autocrack when player have under 29 hp - by JJack - 10.01.2015, 22:32
Re: autocrack when player have under 29 hp - by bigboy81 - 10.01.2015, 22:38
Re: autocrack when player have under 29 hp - by CalvinC - 10.01.2015, 22:51
Re: autocrack when player have under 29 hp - by bigboy81 - 10.01.2015, 22:55
Re: autocrack when player have under 29 hp - by CalvinC - 10.01.2015, 23:04
Re: autocrack when player have under 29 hp - by bigboy81 - 10.01.2015, 23:19
Re: autocrack when player have under 29 hp - by CalvinC - 10.01.2015, 23:44
Re: autocrack when player have under 29 hp - by bigboy81 - 11.01.2015, 00:13

Forum Jump:


Users browsing this thread: 2 Guest(s)