SA-MP Forums Archive
Help with a 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: Help with a percentage (/showthread.php?tid=579783)



Help with a percentage - orel56000 - 29.06.2015

I want to build a hud on the screen that will show the car health in percentage for example if I have 950 health , its will show me 95%, its don't working to me because its saying the health and alot of number after the dot, like 95.234235263%.
How can I fix it ? Thanks!

Sorry for my bad English.


Re: Help with a percentage - Jefff - 29.06.2015

Use floatround https://sampwiki.blast.hk/wiki/Floatround
format(string,sizeof(string),"%d%%",floatround(Car Health, floatround_ceil));


Re: Help with a percentage - orel56000 - 29.06.2015

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Use floatround https://sampwiki.blast.hk/wiki/Floatround
format(string,sizeof(string),"%d%%",floatround(Car Health, floatround_ceil));
Thanks!


Re: Help with a percentage - benjenden - 30.06.2015

Did that work for you? I'm having the same problem.