I need help for got a good coordinates - 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: I need help for got a good coordinates (
/showthread.php?tid=81819)
I need help for got a good coordinates -
CTCCoco - 14.06.2009
Hey, I create a command to save coordinates for a player, but I got bad coordinates. This is the code:
Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new posint = GetPlayerInterior(playerid);
PlayerInfo[playerid][playerx] = x;
PlayerInfo[playerid][playery] = y;
PlayerInfo[playerid][playerz] = z;
PlayerInfo[playerid][playerint] = posint;
Then if a player save the coordinates, its just save bad: Playerx=1152861123 Playery=-993133540 Playerz=1096859648
How I can save a good coordinates like 1473.57 ? Because if a player spawn with these coordinates the server be crazy and crash...
Thanks for all, and sorry for my bad english, I speak spanish.
Re: I need help for got a good coordinates -
Weirdosport - 14.06.2009
You're saving the co-ordinates as Integers (1,2,3) not floats (123.123, 345.345 etc).
When you save a float as an integer it comes up with a number like yours.
I presume you're using an enum somewhere.
Change this:
playerx,
playery,
playerz,
to
Float
layerx,
Float
layery,
Float
layerz,