Previously, the "/ac send" command could only be used to send an audio message to a specific player or all players (who are connected), but this was not very useful since it didn't support dynamic selection of target players such as for use with command blocks.
Support for command blocks has been long requested, so I finally got around to adding a few basic sub commands to "/ac send" that enables dynamic player selection as the targets for the audio command. Additionally, you can now stop/clear the currently playing audio by specifying an asterisk * as the <audio-id> argument.
- Send a server command to play an audio source for selected target players (on the provided or default track).
Note: Use '*' as the <audio-id> to stop/clear the currently playing audio (if there is any).
/ac send @a <audio-id> [track-id]
- Send an audio source to play for all players/ac send @a <world> <region-id> <audio-id> [track-id]
- Send an audio source to play for all players inside a region/ac send @p <audio-id> [track-id]
- Send an audio source to play for the closest player to the executing command_block or entity/ac send @p <world> <x> <y> <z> <audio-id> [track-id]
- Send an audio source to play for the closest player to a location/ac send <player-name> <audio-id> [track-id]
- Send an audio source to play for a specific player
Targeting multiple players using "@a" target selector:
Send the "celebration-music" audio source to the default track for all connected playersCode (Text):/ac send @a celebration-music
Send the "boss-audio" audio source to the background track for all connected players in the nether world that are inside the region named "audio-region-1"Code (Text):/ac send @a world_nether audio-region-1 boss-audio background
Targeting the closest player using "@p" target selector:
NOTE: This does not yet support a distance argument and will search the entire world until it finds the closest player (if any). I may later implement the distance argument much like how it works with command blocks (EX: "/ac send @p[distance=..10] audio-id")
Send the "scary-sounds" audio source to the background track for the connected player that is closest to the executing command block or executing entity. If this command is executed by a player, it will target the closest connected player to them.Code (Text):/ac send @p scary-sounds background
Send the "scary-sounds" audio source to the background track for the connected player in "empire" world that is closest to location x=123, y=65, z=321.Code (Text):/ac send @p empire 123 65 321 scary-sounds background