I need help for got a good coordinates
#1

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.
Reply
#2

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

Floatlayerx,
Floatlayery,
Floatlayerz,
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)