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?

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

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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