Help with GetPlayerPos - 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: Help with GetPlayerPos (
/showthread.php?tid=649361)
Help with GetPlayerPos -
C0oL3r - 07.02.2018
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
Re: Help with GetPlayerPos -
Fratello - 07.02.2018
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)
Re: Help with GetPlayerPos -
Abagail - 07.02.2018
Positions are floats, those numbers are the integer conversion. To show floats within format, you need to use the %f specifier.
Re: Help with GetPlayerPos -
C0oL3r - 07.02.2018
Thanks all for help!
Re: Help with GetPlayerPos -
Mugala - 08.02.2018
dude, you had a same problems with another scripts, I suggest to check your whole scripts for this kind of issues.
Re: Help with GetPlayerPos -
C0oL3r - 08.02.2018
i solved all that issues