SA-MP Forums Archive
get the first 4 digits of x,y,z without float round - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: get the first 4 digits of x,y,z without float round (/showthread.php?tid=239734)



get the first 4 digits of x,y,z without float round - THE_KNOWN - 14.03.2011

how do you do it?


Re: get the first 4 digits of x,y,z without float round - Sasino97 - 14.03.2011

Do you want Example: 5.153454 to be readed just as 5.1534 ?

pawn Код:
format(string,sizeof(string),"%.4f, %.4f, %.4f ", X, Y, Z); //instead of %f do %.(num of digits)f



Re: get the first 4 digits of x,y,z without float round - THE_KNOWN - 14.03.2011

no only 5 nothing else after it. eg: 2444.12342, i want it as only 2444


Re: get the first 4 digits of x,y,z without float round - SwisT - 14.03.2011

try
pawn Код:
%0.f



Re: get the first 4 digits of x,y,z without float round - RyDeR` - 14.03.2011

or
pawn Код:
"%.0f"
EDIT: I guess he means, round a float without using floatround. And I guess his coordinates are > 1000 so, he has four digits. That's what I think.


Re: get the first 4 digits of x,y,z without float round - THE_KNOWN - 14.03.2011

works thanks you


Re: get the first 4 digits of x,y,z without float round - THE_KNOWN - 14.03.2011

i actually wanted the numbers before the decimal sry


Re: get the first 4 digits of x,y,z without float round - Sasino97 - 14.03.2011

Quote:
Originally Posted by THE_KNOWN
Посмотреть сообщение
i actually wanted the numbers before the decimal sry
If you want to transform a floating point to an <integer> in a string you should do what ******, RyDer' and SwisT said