Vanilla Minecraft, @p selector Shop efficiency

Vanilla Minecraft, @p selector Shop efficiency - Ice Cream on Cone With Gray Metallic Holder Photo

For my Prison Game I have a shop for buying, but the @p selector is hard to make work in the case of more than one player nearby. I have a Scoreboard called money used for currency. The commands I'm using for the shop are:

/give @p[r=4,score_money_min=50] minecraft:wooden_pickaxe 1 0 {CanDestroy:["minecraft:log","minecraft:log2","minecraft:stone","minecraft:iron_ore"]}

/scoreboard players remove @p[r=5,score_money_min=50] money 50

I'm using 1.9 for this. If possible I would like to select the individual players who press the button to activate the commands and not rely on the @p command.



Best Answer

Use a custom sign with a 'click_on' command such as '/trigger bought_pickaxe_w'. Have some command blocks on a clock with your commands, as well as '/scoreboard players set @a[score_bought_pickaxe_w_min=1] bought_pickaxe_w 0'.

If you dont know how to put commands on signs, then look at this link on Minecraft Wiki which will explain you how to use JSON on a sign.




Pictures about "Vanilla Minecraft, @p selector Shop efficiency"

Vanilla Minecraft, @p selector Shop efficiency - Man Wearing Ice Cream
Vanilla Minecraft, @p selector Shop efficiency - Brown Wooden Table With Chairs
Vanilla Minecraft, @p selector Shop efficiency - Mechanic Repairing a Truck Engine



What is@ p in minecraft?

@p. Targets the nearest player from the command's execution. If there are multiple nearest players, caused by them being precisely the same distance away, the player who most recently joined the server is selected. In Bedrock Edition, @p only targets players who are alive.

What does@ e do in minecraft?

The other target selectors are \u201c@a\u201d for all players, \u201c@r\u201d for a random player, and \u201c@e\u201d will target all entities. Entities include everything that isn't a block, like monsters, snowballs, animals, and arrows. The command should execute successfully and give you a new block.

What is @A Minecraft command?

@p = nearest player. @r = random player. @a = all players. @e = all entities. @s = the entity executing the command.



*IL MIGLIOR PLUGIN* *GRATUITO* PER CREARE UNO *SHOP* NEL TUO SERVER DI *MINECRAFT*! *ECONOMYSHOPGUI*




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Valeria Boltneva, Snapwire, เจ้าหมี 'แฮปปี้อยู่, cottonbro