Getpos

Poll

Opinions please.

Meh, not really that useful
0 (0%)
alright, useful at some points
0 (0%)
Good, pretty dang useful
0 (0%)
Really good, like holy crap, Super Duper useful
0 (0%)

Total Members Voted: 0

Author Topic: Getpos  (Read 4306 times)

Get your position!
http://www.mediafire.com/download/wvvm2o82mw7628a/Server_getpos.zip
reopening thread since crown told me not to because /getransform is the position your looking at instead of where you're standing
« Last Edit: September 30, 2015, 02:36:37 PM by Bow »




mine is client-sided and does the exact same thing via bottomprint :p

mine is client-sided and does the exact same thing via bottomprint :p
good for you..

What can this be used for?

mine is client-sided and does the exact same thing via bottomprint :p
That's not hard to make: clientCmdBottomPrint("My position (" @ ServerConnection.getControlOb ject().getClassName() @ "): " @ ServerConnection.getControlOb ject().getPosition(), 3);

What can this be used for?
This can be used to figure out your position, also, where someone says where are you or trying to locate something, you can just type the loaction.
Please keep in mind that im new to coding, so please bare with me.
« Last Edit: September 27, 2015, 03:22:28 PM by Bow »

If you also want someone to see how far they are from you, you could try this:
Not sure why I am posting this, though, oh well. Most lines have a comment so you can try to learn how it works

Code: server.cs (34 lines)
// /WhoisDist "name"
function serverCmdWhoisDist(%this, %who)
{
   //Make sure the player exists
   if(!isObject(%player = %this.player))
       return;

   //Create a 1 second timeout using $Sim::Time, getSimTime() returns milliseconds
   if($Sim::Time - %this.lastCall < 1)
       return;

   //Find who we need to see
   if(!isObject(%target = findClientByName(%who)))
    {
       //Let them know we didn't find someone
       %this.chatMessage("We couldn't find \'" @ %who @ "\'");
       return;
    }

   //Let them know we didn't find the player's target
   if(!isObject(%targPlayer = %target.player))
    {
       %this.chatMessage("We couldn't find the player of \'" @ %target.getPlayerName() @ "\'");
       return;
    }

   //VectorDist(vector3f pos1, vector3f pos2) returns a distance, so let's tell the person about it
   %this.chatMessage("Distance from (" @ %target.getPlayerName() @ "): " @ vectorDist(%targPlayer.getPosition(), %player.getPosition()));
   //Tell the positions of the client and the target
   %this.chatMessage("My position: " @ %player.getPosition() @ " | Their position (" @ %target.getPlayerName() @ "): " @ %targPlayer.getPosition());

   //Put the simtime down so it can be timed out if they use the command too fast
   %this.lastCall = $Sim::Time;
}


If you also want someone to see how far they are from you, you could try this:
Not sure why I am posting this, though, oh well. Most lines have a comment so you can try to learn how it works

Code: server.cs (34 lines)
// /WhoisDist "name"
function serverCmdWhoisDist(%this, %who)
{
   //Make sure the player exists
   if(!isObject(%player = %this.player))
       return;

   //Create a 1 second timeout using $Sim::Time, getSimTime() returns milliseconds
   if($Sim::Time - %this.lastCall < 1)
       return;

   //Find who we need to see
   if(!isObject(%target = findClientByName(%who)))
    {
       //Let them know we didn't find someone
       %this.chatMessage("We couldn't find \'" @ %who @ "\'");
       return;
    }

   //Let them know we didn't find the player's target
   if(!isObject(%targPlayer = %target.player))
    {
       %this.chatMessage("We couldn't find the player of \'" @ %target.getPlayerName() @ "\'");
       return;
    }

   //VectorDist(vector3f pos1, vector3f pos2) returns a distance, so let's tell the person about it
   %this.chatMessage("Distance from (" @ %target.getPlayerName() @ "): " @ vectorDist(%targPlayer.getPosition(), %player.getPosition()));
   //Tell the positions of the client and the target
   %this.chatMessage("My position: " @ %player.getPosition() @ " | Their position (" @ %target.getPlayerName() @ "): " @ %targPlayer.getPosition());

   //Put the simtime down so it can be timed out if they use the command too fast
   %this.lastCall = $Sim::Time;
}

ah, thanks

good for you..
no point in remaking an add-on that works perfectly (shameless self promo)

Remaking an add-on that's pretty easy to make and then trying to show it off lol

That's pretty neat, but since it seems (from my understanding) to just tell you their distance, do you think that you could make a script that announces the following

You (NAME1) type and send:
/revealposition [NAME2]

You see the following:
You have revealed your position to [NAME2].

They see the following:
[NAME1] has revealed their location to you:
  +  They are located at the coordinates [NAME1:POSITION].
  +  You are located at the coordinates [NAME2:POSITION].
  +  They are located [DISTANCE(units?)] away to the [DIRECTION(In degrees N, E, S, W)]
To tell someone where you are, say /revealposition [THEIR NAME]

Problem doing these kind of things is that you could be spammed with messages, other than using the timeouts you could be searched by many people

That's pretty neat, but since it seems (from my understanding) to just tell you their distance, do you think that you could make a script that announces the following

You (NAME1) type and send:
/revealposition [NAME2]

You see the following:
You have revealed your position to [NAME2].

They see the following:
[NAME1] has revealed their location to you:
  +  They are located at the coordinates [NAME1:POSITION].
  +  You are located at the coordinates [NAME2:POSITION].
  +  They are located [DISTANCE(units?)] away to the [DIRECTION(In degrees N, E, S, W)]
To tell someone where you are, say /revealposition [THEIR NAME]
Yeah, I agree with Kyuande. Also, im not that advanced to do that yet.