SA-MP Forums Archive
Express a float number as an integer? - 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: Express a float number as an integer? (/showthread.php?tid=511309)



Express a float number as an integer? - Aerotactics - 04.05.2014

So I fixed my previous error with the help of a forum member, but I ran into an issue with float numbers:



What I'd like is a way to express that number as an integer between 0 and 1000 (like a default vehicle health integer).

I believe what you see is what you get, the vehicle health is expressed as a float, and formatted into a textlabel. I want the text label number to show 0-1000 and I don't know how to do that. Seeing my script shouldn't be necessary.


Re: Express a float number as an integer? - Patrick - 04.05.2014

You don't want any number after the decimal. You simply do this.

pawn Код:
format(string[], sizeof(string[]), "%.0f", args);



Re: Express a float number as an integer? - Aerotactics - 04.05.2014

Quote:
Originally Posted by Patrick_
Посмотреть сообщение
You don't want any number after the decimal. You simply do this.

pawn Код:
format(string[], sizeof(string[]), "%.0f", args);
Yup, thanks. I'm not thinking clearly this afternoon lol