Help In Getting the Coordinates
#1

Hey Guys I have come here with another prob....
The prob is The TextDraw Which i created Of Getting players position is giving me wrong coordinates...
The Code:
Code:
	new Float:X,Float:Y,Float:Z;
	GetPlayerPos(playerid,X,Y,Z);
	new string[245];
	format(string,sizeof(string),"X: %d Y: %d Z: %d",X,Y,Z);
	XYZ = TextDrawCreate(26,300,string);
	TextDrawFont(XYZ,2);
	TextDrawLetterSize(XYZ,0.3,1);
	TextDrawBackgroundColor(XYZ,0x000000FF);
	TextDrawSetOutline(XYZ,1);
	TextDrawSetShadow(XYZ,1);
	TextDrawColor(XYZ,0xFFFFFFFF);
	TextDrawShowForPlayer(playerid,XYZ);
When I do /lgoto 0 0 0 [my admin system]
it gets me to farm which is center of San andreas... but the Text Draw shows other coordinates anyone knows whats the prob?
Reply
#2

Go into your game and goto the position you want to Teleport to and type /save [Teleport].
Then head into your computer documents and hit on Gta san andreas then hit SAMP then hit SavedPositions then copy the coords from it and put them at for example
pawn Code:
SetPlayerPos(playerid, CoordsX,CoordsY,CoordsZ);
Reply
#3

Change this line
pawn Code:
format(string,sizeof(string),"X: %d Y: %d Z: %d",X,Y,Z);
to this
pawn Code:
format(string,sizeof(string),"X: %f Y: %f Z: %f",X,Y,Z);
thank me later


Quote:
Originally Posted by Torus
View Post
it gets me to farm which is center of San andreas... but the Text Draw shows other coordinates anyone knows whats the prob?
Because "0 0 0" is the coords for the farm?
Reply
#4

Quote:
Originally Posted by tiernantheman
View Post
Go into your game and goto the position you want to Teleport to and type /save [Teleport].
Then head into your computer documents and hit on Gta san andreas then hit SAMP then hit SavedPositions then copy the coords from it and put them at for example
pawn Code:
SetPlayerPos(playerid, CoordsX,CoordsY,CoordsZ);
dude i dont want to set any pos i just want the text draw to give correct co ordinates of the players position...
its giving me wrong co ordinates even if i put it on OnPlayerUpdate with TextDrawSetString...
Reply
#5

Quote:
Originally Posted by [NWA]Hannes
View Post
Change this line
pawn Code:
format(string,sizeof(string),"X: %d Y: %d Z: %d",X,Y,Z);
to this
pawn Code:
format(string,sizeof(string),"X: %f Y: %f Z: %f",X,Y,Z);
thank me later



Because "0 0 0" is the coords for the farm?
Dude no i have a cmd to tele to /sf
Co Ordinates are :
-2089.7769,-83.8671,35.1641

But It Shows:
-9897,-1029,1108
Reply
#6

Quote:
Originally Posted by Torus
View Post
dude i dont want to set any pos i just want the text draw to give correct co ordinates of the players position...
its giving me wrong co ordinates even if i put it on OnPlayerUpdate with TextDrawSetString...
Oh my bad I miss-read it sorry. :P
Reply
#7

Quote:
Originally Posted by Torus
View Post
Dude no i have a cmd to tele to /sf
Co Ordinates are :
-2089.7769,-83.8671,35.1641

But It Shows:
-9897,-1029,1108
Yes I know. Do what i said and it will show correct.
Reply
#8

Quote:
Originally Posted by [NWA]Hannes
View Post
Yes I know. Do what i said and it will show correct.
Nope Not Working Still .....
Reply
#9

pawn Code:
// Under OnGameModeInIt
    XYZ = TextDrawCreate(26,300,"   ");
    TextDrawFont(XYZ,2);
    TextDrawLetterSize(XYZ,0.3,1);
    TextDrawBackgroundColor(XYZ,0x000000FF);
    TextDrawSetOutline(XYZ,1);
    TextDrawSetShadow(XYZ,1);
    TextDrawColor(XYZ,0xFFFFFFFF);
// Under OnPlayerUpdate Or Wherever You Are Using This.
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    new string[245];
    format(string,sizeof(string),"X: %f Y: %f Z: %f",X,Y,Z);
    TextDrawSetString(XYZ,string);
    TextDrawShowForPlayer(playerid,XYZ);
EDIT: Fixed Again.
Reply
#10

Player Positions are float not interger.
You use %d instead of %f
%d or AKA %i is for integer
%f for positions/health etc...
Reply
#11

Quote:
Originally Posted by Littlehelper[MDZ]
View Post
pawn Code:
// Under OnGameModeInIt
    XYZ = TextDrawCreate(26,300,"   ");
    TextDrawFont(XYZ,2);
    TextDrawLetterSize(XYZ,0.3,1);
    TextDrawBackgroundColor(XYZ,0x000000FF);
    TextDrawSetOutline(XYZ,1);
    TextDrawSetShadow(XYZ,1);
    TextDrawColor(XYZ,0xFFFFFFFF);
    TextDrawShowForPlayer(playerid,XYZ);
// Under OnPlayerUpdate Or Wherever You Are Using This.
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    new string[245];
    format(string,sizeof(string),"X: %f Y: %f Z: %f",X,Y,Z);
    TextDrawSetString(XYZ,string);
    TextDrawShowForPlayer(playerid,XYZ);
EDIT: Fixed.
NOPE!
Reply
#12

DAFUQ?
What are the errors or problem with that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)