0

I am trying to make a PvP mini-game and I'm trying to make it so that when a certain amount of players are left, it awards the players inside of the arena.

I have already managed to make the player counter for the area using some command blocks and a comparator, but I only know how to find the amount of players with testfor, not the actual names of the players.

How can I find the names of the players inside the arena?

2
  • What's your current /testfor command? You should just be able to use the selector from that in your /give commands.
    – SirBenet
    Commented Aug 30, 2016 at 17:36
  • yah i didnt know i could do that b4 Commented Sep 2, 2016 at 12:37

1 Answer 1

1

Power a repeat command block with this command:

/testfor @a[x=X,y=Y,z=Z,r=R]

Where X, Y, Z are the middle coordinates of the arena, R is the radius of the arena. Now, put this command in a repeating command block:

/testforblock X2 Y2 Z2 minecraft:command_block -1 {SuccessCount:SC}

Where X2, Y2, Z2 are the coordinates of the 1st command block and SC is the amount of players you want to be left to award them.

Next to the 2nd command block place a chain command block with this command (or another if you don't want to give items, but be sure to use the @a[x=X,y=Y,z=Z,r=R]):

/give @a[x=X,y=Y,z=Z,r=R] minecraft:THE_AWARD_YOU_WANT

Where X, Y, Z are the middle coordinates of the arena.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.