SA-MP Forums Archive
Health and Armour Percentage - 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: Health and Armour Percentage (/showthread.php?tid=570038)



Health and Armour Percentage - ChuckyBabe - 04.04.2015

Hello SA-MP!,

Can u just give me a few more details on how to make a Health And Armour Percentage? +1 Rep


Re : Health and Armour Percentage - FilesMAker - 04.04.2015

You may use GetPlayerHealth, GetPlayerArmour !


Re: Health and Armour Percentage - ChuckyBabe - 04.04.2015

And how to make it to textdraws



EDIT: Like a percentage


Re : Health and Armour Percentage - FilesMAker - 04.04.2015

Just an Example :

Code:
//on gamemode load

new Text:PlayerHealth[MAX_PLAYERS];

//on player spawn or when his status changes or on a command

new Float:Health, TextFormat[32];
GetPlayerHealth(playerid, Health[playerid]);

format(TextFormat, sizeof(TextFormat), "Health: %i %", floatround(Health));
TextDrawSetString(PlayerHealth[playerid], TextFormat);
TextDrawShowForPlayer(playerid, PlayerHealth[playerid]);
Don't forget to build your text draw this is just an exemple wrote in this moment


Re: Health and Armour Percentage - ChuckyBabe - 04.04.2015

Where i will put the Textdraw ID there ?


Re: Health and Armour Percentage - Abagail - 04.04.2015

If you are using different text per player you have to use a player textdraw, not a global one.


Re : Health and Armour Percentage - FilesMAker - 04.04.2015

Just put it as a global pointer !