Player health - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Player health (
/showthread.php?tid=419218)
Player health -
ZeroCools - 27.02.2013
How to make that when player has 5 hp remaining to apply animation crack_deth so he cant run and walk?
Re: Player health -
2KY - 27.02.2013
OnPlayerUpdate would probably be the only solution, short of a 500ms or so timer, so do this..
pawn Код:
new
AlmostDead [ MAX_PLAYERS ] = 0; // Create this player variable on the top of the script.
public OnPlayerUpdate ( playerid )
{
if( AlmostDead [ playerid ] == 1 ) return true;
new
Float: health;
GetPlayerHealth ( playerid, health );
if( health <= 5.0 )
{
ApplyAnimation ( playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0 );
ApplyAnimation ( playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0 );
// Apply the animation twice so it works without preloading.
TogglePlayerControllable ( playerid, false );
// This is optional - warning, it makes them invincible if they can't control their character.
AlmostDead [ playerid ] = 1;
}
return true;
}
Re: Player health -
mastermax7777 - 27.02.2013
dont togle player ... he wont be able to exit animation anyways...
Re: Player health -
2KY - 27.02.2013
Quote:
Originally Posted by mastermax7777
dont togle player ... he wont be able to exit animation anyways...
|
Hense the 'This is optional' comment.
Re: Player health -
ZeroCools - 27.02.2013
Thanks