SA-MP Forums Archive
How to find position - 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: How to find position (/showthread.php?tid=485306)



How to find position - Ejcrushing - 03.01.2014

How do i find the position of the player like the codes Get the X Y Z coordinates of a player.
Example: SetPlayerPos(playerid, 2475.6655,-1662.9609,13.3326);

So my question is how do i find the current position of the player like something that says the player position codes like
2475.6655,-1662.9609,13.3326

So thats the question maybe when you type a command it comes the player position codes or something like that.

I would really appreciate if someone can help,


Re: How to find position - driftg0d - 03.01.2014

Код:
//... On command
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
// You can now use x,y, and z as the players position for SetPlayerPos,etc.
there you go


Re: How to find position - iOxide - 03.01.2014

First create a local veriable

pawn Код:
new  Float:x, Float:y, Float:z;
then use
pawn Код:
GetPlayerPos(playerid, x, y, z);



Re: How to find position - Ejcrushing - 03.01.2014

So how do i create a command for this.
Code:
Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
Can you make like when i type /pos the position codes come up?


Re: How to find position - driftg0d - 03.01.2014

Sure.

Код:
CMD:pos(playerid,params[])
{
	new Float:x, Float:y, Float:z, msg[254];
	GetPlayerPos(playerid,x,y,z);
	format(msg,sizeof(msg),"Your current pos: X:%d Y:%d Z:%d",x,y,z);
	SendClientMessage(playerid,-1,msg);
	return 1;
}



Re: How to find position - iOxide - 03.01.2014

pawn Код:
CMD:pos(playerid, params[])
{
    new Message[200], Float:x, Float:y, Float:z;

    GetPlayerPos(playerid, x, y, z);
    format(Message, sizeof(Message), "Location: X%4.2f, Y%4.2f, Z%4.2f", x, y, z);
    SendClientMessage(playerid, 0xFFFFFFFF, Message);
    return 1;
}
Try that, i haven't tested. Tell me if it works.

Edit: lol again he was faster then me, oh well


Re: How to find position - Ejcrushing - 03.01.2014

Quote:
Originally Posted by driftg0d
Посмотреть сообщение
Sure.

Код:
CMD:pos(playerid,params[])
{
	new Float:x, Float:y, Float:z, msg[254];
	GetPlayerPos(playerid,x,y,z);
	format(msg,sizeof(msg),"Your current pos: X:%d Y:%d Z:%d",x,y,z);
	SendClientMessage(playerid,-1,msg);
	return 1;
}
Ok thanks i will give rep but i need to wait 24 hours ill give after that remind me


And this:
Код:
CMD:pos(playerid, params[])
{
    new Message[200], Float:x, Float:y, Float:z;

    GetPlayerPos(playerid, x, y, z);
    format(Message, sizeof(Message), "Location: X%4.2f, Y%4.2f, Z%4.2f", x, y, z);
    SendClientMessage(playerid, 0xFFFFFFFF, Message);
    return 1;
}
Ill try it thanks