Help with GetPlayerPos
#1

Anyone know why when i try to GetPlayerPos it's get coords like that:

Code:
1156750726, 1151640679, 1091837952
And the numbers are not correct either, not only that is missing the "."

the code is that:

Code:
COMMAND:mylocation(playerid, params[])
{
	new Float:Pos[3];
	GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
	new string[255];
	format(string, sizeof(string), "Your coordinates are: X: %d, Y: %d, Z: %d", Pos[0], Pos[1], Pos[2]);
	SendClientMessage(playerid, COLOR_RED, string);
}
it's test command, i maked it for test if is from another command or it's a general problem, and it's not working.
I tried with strcmp and still not working
Reply
#2

Code:
format(string, sizeof(string), "Your coordinates are: X: %d, Y: %d, Z: %d", Pos[0], Pos[1], Pos[2]);
Change %d (whole number) to %f (float)
Reply
#3

Positions are floats, those numbers are the integer conversion. To show floats within format, you need to use the %f specifier.
Reply
#4

Thanks all for help!
Reply
#5

dude, you had a same problems with another scripts, I suggest to check your whole scripts for this kind of issues.
Reply
#6

i solved all that issues
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)