returning float in callremotefunction - 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: returning float in callremotefunction (
/showthread.php?tid=445273)
returning float in callremotefunction -
.Mento - 20.06.2013
So I'm returning float values by CallRemoteFunction, but it returns more something else than it's supposed to causing it to spawn me at a wrong position.
I have this at the end:
return SpawnPos[cpID][Coord];
When it should return:
2271.7598,-1658.9670,14.7538
it actually returns:
2271.759765,-1658.967041,14.753800
How do I fix this?
Re: returning float in callremotefunction -
Scenario - 20.06.2013
EDIT: Yes, I clearly need more sleep.

Vince has the right idea.
Re: returning float in callremotefunction -
Vince - 20.06.2013
Float values are not absolute values and I don't see anything wrong with those return values either. They have more significant digits, but so what?
Re: returning float in callremotefunction -
Sinner - 20.06.2013
Quote:
causing it to spawn me at a wrong position
|
I doubt that, since the returned values only differ 0.0001m max. If you must round them off you can use format() with the %.04f specifier.
pawn Код:
new Float:exact = 1.1266666666;
new rounded[32];
format(rounded, sizeof(rounded), "%.04f", exact);
// rounded = 1.1267