[HELP] Decimal number
#1

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 !
Reply
#2

Use floatround

https://sampwiki.blast.hk/wiki/Floatround
Reply
#3

Quote:
Originally Posted by Sellize
View Post
can you do it with example ?
Reply
#4

floatround(Time[playerid]/60)
Reply
#5

Quote:
Originally Posted by Konstantinos
View Post
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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)