Question
#7

That converts a float to an integer...
Please read [This Post] carefully.

Edit: Solved.

Question:
pawn Код:
new Float: X, Float: Y, Float: Z;

GetPlayerPos(playerid, X, Y, Z);
Okay let's say X is 1499.890984, Y is 38.796445, and Z is not used.
I don't want the last 4 digits, I just want X to be 1499.89 and Y to be 38.79.
Basically rounding to the hundredth place in a decimal (float).
How do I do that?

Answer
pawn Код:
new Float: X, Float: Y, Float: Z;

GetPlayerPos(playerid, X, Y, Z);

X = (floatround((X * 100)) / 100);
Y = (floatround((X * 100)) / 100);
Reply


Messages In This Thread
Question - by Sniper Kitty - 26.07.2012, 05:34
Re: Question - by Genuine - 26.07.2012, 05:38
Re: Question - by Sniper Kitty - 26.07.2012, 05:56
Re: Question - by McCurdy - 26.07.2012, 06:17
Re: Question - by Sniper Kitty - 26.07.2012, 06:20
Re: Question - by newbienoob - 26.07.2012, 06:30
Re: Question - by Sniper Kitty - 26.07.2012, 06:32

Forum Jump:


Users browsing this thread: 1 Guest(s)