SA-MP Forums Archive
Do not display decimals (100.00) - 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: Do not display decimals (100.00) (/showthread.php?tid=334583)



Do not display decimals (100.00) - HondaCBR - 15.04.2012

I have

Przebieg[i] += 0.05
Gas[i] -= 0.2

and im using a textdraw to show this

new stringPRZEBIEG[128];
format(stringPRZEBIEG,sizeof(stringPRZEBIEG),"%d km",Przebieg[vehicle]);
Textdraw6[playerid] = CreatePlayerTextDraw(playerid,557.000000, 431.000000, stringPRZEBIEG);

how can I show the milage when its done a full mile so insted of 0.05 then 0.1, I just want to see 1, 2 , 3


Re: Do not display decimals (100.00) - [HiC]TheKiller - 15.04.2012

Take a look at https://sampwiki.blast.hk/wiki/Floatround . This rounds the float value to the closest full number.