If you only want to teleport people who are in a certain group, you can use the new scoreboard command to create a 'group' of people (using teams), and then teleport only that team with this command (targets nearest player in the group specified)
/tp @p[team=<internal group name>,<other params here>] <x> <y> <z>
To set up your groups, you can create a group like this:
/scoreboard teams add <internal group name> <display name>
And then add people to this group like this:
/scoreboard teams join <internal group name> <user name>
The advantage of this system is also that you can use it actually to separate groups in the actual game. The scoreboard command has a feature that means that the display name
of a team will be displayed before the actual username, appearing like this in the chat:
[<display name>] <user name>: ...
More info on this system can be found in the wiki page linked above.
Changing the @p
in the first command above to a player name will stop it from working, because parameters that are inside the [
and ]
will only work for @p
, @a
, and @r
. So you cannot substitute the first command above to /tp <player name>[r=2] <x> <y> <z>
. It just won't work.
If you really want to use the r
parameter on a single person, try using the above method that uses teams, but only put one person in the team. Here is a quick way to do this. Type these into the command console:
/scoreboard teams add <internal player name> <external player name>
/scoreboard teams join <internal player name> <player name>
And then in the command block, to teleport that person if they are in a radius of 2, you could use:
/tp @p[team=<internal player name>,r=2] <x> <y> <z>
Alternatively, you could just specify the name of the player in the selector. Following the previous example, if you want to teleport a certain person if they are in a radius of 2, you could use:
/tp @p[name=<player name>,r=2] <x> <y> <z>
Hilltops, plains, valley floors, and plateaus are relatively common also, and make good spots to build. When I did it, I had no trouble finding several nice places within a quick walk.
Best Answer
I think the answer from MBraedley is correct: the best way to handle this scenario (allowing access to a single player at a time) would be to use Command Blocks to teleport one player into and out of your quiz area. You can program a Command Block to teleport the nearest player to a set of coordinates like so:
I don't know what would happen if two players somehow managed to be the exact same distance from the command block (i.e. does just one get teleported, or do they both get teleported since there is a tie for the "closest"). This additional argument may be necessary to limit it to only one player:
The next step is to create a circuit whereby clicking an "entry" button will teleport one player into the quiz area, deactivating this button so that it cannot teleport anyone else in until the player exits the quiz area by clicking a second "exit" button, teleporting them out. Here's one such example circuit I just threw together in my survival game:
The blue blocks are buttons that feed their signals into AND gates (green blocks). The outputs of the AND gates will activate Command Blocks (shown here as redstone lamps at the bottom of the image) and will also feed into the input of a T flip-flop circuit (red blocks). The output of the toggle circuit runs behind the red blocks and feeds into an input of each of the AND gates.
When the toggle circuit is in the "off" state (no output, as shown in the image) then the signal from the right button is disabled and the right redstone lamp (i.e. Command Block) cannot be activated. Activating the left button will cause the left redstone lamp to activate and immediately flip the toggle to the "on" state. This will subsequently disable the signal from the left button and reenable the signal from the right button.
This circuit should give you the ability to allow one player at a time to teleport into your quiz area via a button press. Once they reach the end they can then press another button to teleport out and reactivate the entry button for the next player. I'd also suggest enclosing the circuitry and your quiz area in bedrock, so your average player can't mess with any of it.