So, I'm making a PVP map where all the players have empty maps that they can right-click, and it turns into a normal map. A command block then clears the map from their inventory, and sends a signal to a comparator that it has cleared it. Another command block then applies a certain affect based on the class they are playing as. What I want to know is: is there any way at all to make it so a command block targets a player that's closest to the player that clicked the map? The classes will be divided up into teams. It will be one large map. Thank you for your help.
I know one way to do this but it can be very time consuming if you have a large amount of players.
What I think if is if you tag all the players with numbers at the start of the game you can know who's who later on when you need it. Say it's a 16 player game, the players then each get a score from 1-16 in a scoreboard.
Say I'm player 9 and I activate my map, you would then not only need 1 clear command that clears the players of maps but rather 16 of them, each only clearing players with a specific number in the scoreboard, in my case, 9. Each of these 16 clear commands would then lead to their own row of blocks that gives them and only them the approprite effect depending on which class they chose.
So in summary, instead of make 1 row of command blocks you would have to make 16 containing the same commands but changing the scoreboard number they apply to.
Hope that made sense
I am very good with redstone and command blocks and i realy think that is right what you said.
I am very good with redstone and command blocks and i realy think that is right what you said.