Use Certain Commandblock commands with @p or @a

Use Certain Commandblock commands with @p or @a - Free stock photo of adult, artisan, arts and crafts

I originally wanted to attach the /playsound random.orb, when the scoreboard objective Bow got a value of 1 which was tracking stat.useItem.minecraft.bow, So when the player shot an arrow the sound would play, but if the player got too far away, the sound would not be heard.

I then tried to summon a Mine cart Command Block relative to the player using @p ,which would activate using an also spawned redstone block which would be removed instantly however the /summon and /fill commands don't support the @p or @a. Or any way to track player coordinates then use them to spawn blocks.

I couldn't think of another way to make the sound occur everywhere when a player/one player fires the bow.



Best Answer

If you want it to always work at the position of the player, you could also do this:

execute as <player> at <player> run playsound <sound> <player> ~ ~ ~ [volume] [pitch] [minimumVolume]



Pictures about "Use Certain Commandblock commands with @p or @a"

Use Certain Commandblock commands with @p or @a - Young troubled woman using laptop at home
Use Certain Commandblock commands with @p or @a - High angle of pensive African American female freelancer in glasses and casual clothes focusing on screen and interacting with netbook while sitting at table with glass of yummy drink on cafe terrace in sunny day
Use Certain Commandblock commands with @p or @a - Serious ethnic young woman using laptop at home



What is @A in Minecraft commands?

How to use Minecraft commands
  • @p = nearest player.
  • @r = random player.
  • @a = all players.
  • @e = all entities.
  • @s = the entity executing the command.


What does @P mean in command blocks?

The \u201c@p\u201d is a target selector. The selector \u201c@p\u201d selects the nearest player. Alternatively, you could also use your Minecraft username, but if you run a command from the console you will always be the nearest player.

What does @P do in MC?

@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.

How does @s work with command blocks?

@s (Entity executing the command)The @s target selector is used to target the entity that is executing the command. This is often referred to as "yourself" in the Minecraft help.



18 Items You Can ONLY Get With COMMANDS In Minecraft (1.13-1.17+)




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

Images: Karolina Grabowska, Andrea Piacquadio, Andrea Piacquadio, Andrea Piacquadio