[HELP] Decimal number - 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] Decimal number (
/showthread.php?tid=575306)
[HELP] Decimal number -
M0HAMMAD - 25.05.2015
hi
how i can change Decimal numbers to number
like
1.05 to
1 ?
this my code:
pawn Code:
format(string,sizeof(string),"For Chating You Must Wait %d:%02d",Time[playerid]/60,NeedCode);
i do it for minute, Time[playerid] its a second ! now only Second (%02d) Remain.
i wanna do this
((Time[playerid]/60)x)-Time[playerid]. x will do something to Decimal numbers from Division become a number.
sorry for my bad english !
Re: [HELP] Decimal number -
Sellize - 25.05.2015
Use floatround
https://sampwiki.blast.hk/wiki/Floatround
Re: [HELP] Decimal number -
M0HAMMAD - 25.05.2015
Quote:
Originally Posted by Sellize
|
can you do it with example ?
Re: [HELP] Decimal number -
Konstantinos - 25.05.2015
floatround(Time[playerid]/60)
Re: [HELP] Decimal number -
Macluawn - 25.05.2015
Quote:
Originally Posted by Konstantinos
floatround(Time[playerid]/60)
|
This wouldnt be correct, since by default floatround rounds to the nearest integer, so 1.5 would be rounded upwards to 2. To get just the integer portion and discard the mantissa, pass
floatround_tozero as the second argument, like so
Code:
floatround(Time[playerid]/60, floatround_tozero)