Author Topic: Getting Coordinates and Teleporting  (Read 1698 times)

I'm creating a Crouch Racing server, and I would like to put in a Shop. I tried to use events to get people to it, but I can not find any methods that work. So all I really need to know is how to get the players Coordinates and teleporting them to that certain spot.

Well.. to get the player's position you can call player::getPosition()

To teleport the player, you can call player::setTransform()

I have a feeling you don't really know what to do with that information though. Can you explain more what you're trying to do? Do you want to make an event that teleports players somewhere? If so, one already exists. Doing it this way will probably be easier anyway, since you only have to use named bricks and not actual positions.

I know there's setPlayerTransform, but I would like a command for it. And retroCheck (In VCE) only allows the player who created the brick to use the command.

I know there's setPlayerTransform, but I would like a command for it. And retroCheck (In VCE) only allows the player who created the brick to use the command.
What kind of command? A /command? Here's a shell /command to put a player at a position.

Code: [Select]
function serverCmdMoveMe(%client) {
    if(isObject(%client.player))
        %client.player.setTransform("0 0 0");
}

You can change the VCE command to whatever you want, you could make it /, :, or another symbol. And that code you just wrote might be what I need. I just have to go to the spot in the game I want it to be at, use player::getPosition() and to find what the coordinates that I am at. Copy them into the teleportation code, And I'm done. Thank you.
« Last Edit: August 22, 2013, 08:02:53 AM by Czar »

You can change the VCE command to whatever you want, you could make it /, :, or another symbol. And that code you just wrote might be what I need. I just have to go to the spot in the game I want it to be at, And I can use that to teleport the players there. Thank you.
My code doesn't interface with VCE. It simply adds a server command (like /Self Delete, /wand, /magicwand, /clearbricks, etc) that you can use anywhere and will teleport you to "0 0 0". If you find the location you want to teleport players to (I suggest spawning a brick there [probably a spawn point would be best] and naming it "testbrick" and putting in console "announce(_testbrick.getPosition());" to get the position) you can replace "0 0 0" with that location to teleport them to your shop. Or you could center your shop around "0 0 0", your call.