26.07.2012, 06:32
That converts a float to an integer...
Please read [This Post] carefully.
Edit: Solved.
Question:
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
Please read [This Post] carefully.
Edit: Solved.
Question:
pawn Код:
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y, Z);
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);