Can command blocks teleport the a person closest to a set of coords instead of the command block itself?

I’m trying to build a teleport system in Minecraft, but the command blocks that have the teleport command (/tp @p x y z) are far away from the pressure plate I use to activate it. I use this world with other people, so I’m worried that other people might be closer to the command blocks than I am, and they will accidentally get teleported. Is there any way to make it so the command blocks teleport the closest person to a certain set of coordinates instead of the command block itself? Is that even possible?

  • How can I play multiplayer against creeps on Minecraft SMP servers?
  • How deep does water have to be to prevent fall damage?
  • How do I create a very long delay with Redstone?
  • Tricks for getting lots of arrows?
  • A more efficient mob pushing redstone circuit?
  • How do I move a Minecraft saved world from my desktop to my server?
  • If an item is too powerful to repair, am I screwed?
  • How can I start a minecraft server from the web?
  • Is a Creeper's blast radius affected by the surrounding material?
  • What can I do to help orienting myself in Minecraft Alpha?
  • Can I change which server my Minecraft skin goes to? (If yes, how?)
  • /testforblocks system problem
  • One Solution collect form web for “Can command blocks teleport the a person closest to a set of coords instead of the command block itself?”

    Yes, you can. It’s pretty simple, use the following code:

    /tp @p[x=0,y=0,z=0,r=0] *tp coordinates*
    

    Where the values x, y, z define the center of the search (the player nearest to these coordinates would get teleported) and r defines the radius of the search. If you don’t want to limit the radius omit r.

    Do not use decimal values for the search center, this will not work.

    See here for more info.

    We love Playing Games, especially Video Games.