SA-MP Forums Archive
health string error - 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 string error (/showthread.php?tid=520764)



health string error - Le3aT - 20.06.2014

I made a new float called health and i made a command to display your health. When I do that command it gives me huge numbers. What shall I do ? I made the format with %i


Re: health string error - Golf - 20.06.2014

use %f beacause it's float


Re: health string error - Haydz - 20.06.2014

You need to use %f to display a float in PAWN - Example below.

pawn Код:
new string[128], float:Health;
GetPlayerHealth(playerid, Health);
format(string,sizeof(string),"Your current health is %0.0f",Health);
SendClientMessage(playerid, 0xFFFFFFFF, string);



Re: health string error - Threshold - 20.06.2014

pawn Код:
new string[35], Float:Health;
GetPlayerHealth(playerid, Health);
format(string, sizeof(string), "Your current health is %0.2f", Health);
SendClientMessage(playerid, -1, string);
Just a little edit of Haydz code.


Re: health string error - Le3aT - 20.06.2014

If i want it in a textdraw like, if he takes damage, it displays the new one.

When I made it, It gives me like 100.00000000


Re: health string error - Le3aT - 20.06.2014

idk what to do, really. can anyone help ?


Re: health string error - Haydz - 20.06.2014

Can you show us the code you already have, we may be able to help fix it .


Re: health string error - Konstantinos - 20.06.2014

https://sampwiki.blast.hk/wiki/Floats
https://sampwiki.blast.hk/wiki/Floats#Float_-.3E_String