SA-MP Forums Archive
Player health lower than 15.0percents - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Player health lower than 15.0percents (/showthread.php?tid=251938)



Player health lower than 15.0percents - MrND - 29.04.2011

Okay, I need help about making it. I wanted to set player animation if he has lower than 15HP. Anyone has idea?


Re: Player health lower than 15.0percents - Slash01 - 29.04.2011

you could make a command to make the animation apply when they have low hp, but the player would have to do it manually. just an idea


Re: Player health lower than 15.0percents - Max_Coldheart - 29.04.2011

Why not just use
pawn Код:
If(GetPlayerHealth(playerid) > 15)
{
    ApplyAnimation(....);
}
Then set a timer to check it and make a loop that checks all players.
Quote:
Originally Posted by SA-MP
This forum requires that you wait 120 seconds between posts. Please try again in 43 seconds.



Re: Player health lower than 15.0percents - KoczkaHUN - 29.04.2011

Код:
public OnPlayerUpdate(playerid)
{
	// blah blah blah
	new Float:health;
	GetPlayerHealth(playerid, health);
	if (health < 15.0 && GetPVarInt(playerid, "fallanim") == 0)
	{
	    SendClientMessage(playerid, 0xff0000ff, "* You have been injured!");
	    ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
	    SetPVarInt(playerid, "fallanim", 1);
	}
	else if (health > 15.0 && GetPVarInt(playerid, "fallanim") == 1) // fixed
	{
	    SetPVarInt(playerid, "fallanim", 0);
	    if (GetPlayerAnimationIndex(playerid) == 386) ClearAnimations(playerid, 1);
	    SendClientMessage(playerid, 0x00ff00ff, "* You have been healed!");
	}
	// blah blah blah
}



Re: Player health lower than 15.0percents - KoczkaHUN - 29.04.2011

fixed the above code