Players::broadcastInDimension
Server-Side Function
JavaScript Syntax
Summary
The `players.broadcastInDimension` function sends a message to all players in a specified dimension. This function is particularly useful for dimension-specific events or announcements, allowing only players in that area to receive the message.
Required Params
- dimension: number — The dimension in which the message will be sent.
- text: string — The message text to broadcast to all players in the specified dimension.
Return value
- void
Syntax
void players.broadcastInDimension(number dimension, string text);
Example
This example sends a message to all players in the same dimension as the command sender.
mp.events.addCommand("say", (player, message) => {
mp.players.broadcastInDimension(player.dimension, `Message from ${player.name}: ${message}`);
});
See also
- Functions
- Players::broadcast
- Players::broadcastInDimension
- Players::broadcastInRange
- Players::call
- Players::callInDimension
- Players::callInRange
- Players::callUnreliable
- Players::callInDimensionUnreliable
- Players::callInRangeUnreliable
- Players::reloadResources
- Pool::apply
- Pool::at
- Pool::exists
- Pool::forEach
- Pool::forEachInDimension
- Pool::forEachInRange
- Pool::getClosest
- Pool::getClosestInDimension
- Pool::toArray
- Pool::toArrayFast