Author Topic: Player Locations?  (Read 1588 times)

I'd like to know what the variables for the players X, Y, and Z location are. I tried %player.locX etc., but it doesn't work.

%pos = %player.getPosition();

gives a three-word string representing the player's coordinates

use getWord(%pos, index starting at 0); to get individual axes, order is X Y Z like you would expect.

also note that +Z is up like it should be lol!!!!

also note that Z is up like it should be lol!!!!

My math courses use Z as up and my physics courses use Y as up... -_-

My math courses use Z as up and my physics courses use Y as up... -_-
Literally the only reason anyone uses Y as up is because on a 2D chart on a board or screen mounted onto a wall has the Y axis going "up."

Literally the only reason anyone uses Y as up is because on a 2D chart on a board or screen mounted onto a wall has the Y axis going "up."
No wonder why Minecraft's X and Y positions are switched.

%pos = %player.getPosition();

gives a three-word string representing the player's coordinates

use getWord(%pos, index starting at 0); to get individual axes, order is X Y Z like you would expect.

also note that +Z is up like it should be lol!!!!
Ok thanks!


so wats confusin u bud talk to old santy

This is what's confusing me now.
Here's my code:
Code: [Select]
function serverCmdLocate(%client, %target)
{
if($Locator::Enable == false)
return messageClient("\c2ERROR: \c4Player Locator has been disabled.");

%target = findclientbyname(%target);

if(isObject(%target))
return messageClient(%client, '', "\c2ERROR: \c4Target has not spawned yet!");
if(%target.player.stealth == true && !%client.isSuperAdmin)
{
return messageClient(%client, '', "\c2ERROR: \c4Cannot find selected target. Target might have stealth.");
}

messageClient(%client, '', "\c4Locator has now been set to target \c2"@%target.name@"\c4.");
Location_HUD(%client, %target);
}
I type /locate E (For EV0_), but then it says "\c2ERROR: \c4Target has not spawned yet!", and I sure have!

Can you use isObject like that?

Also, pretty sure you need to use %target.player if you can.

I type /locate E (For EV0_), but then it says "\c2ERROR: \c4Target has not spawned yet!", and I sure have!

You are checking if the target exists, if it does then you are sending that message. You should be doing if(!isObject(%target)). However checking if %target exists doesn't tell you if they have spawned, you want to be using %target.player, if that doesn't exist then they either haven't spawned, or are dead (and their body has poofed).

Can you use isObject like that?

Also, pretty sure you need to use %target.player if you can.
Ohduh

Also, make sure it's %target.player.
Just %target checks if client exists, which means that they could be dead or loading into the game.

Ok I think I fixed this. Locking... will unlock if I have any further problems.

Thanks to some advice from Dannu, I'm unlocking this now.