Players::broadcastInDimension

From RAGE Multiplayer Wiki
Revision as of 11:04, 10 November 2024 by Shr0x (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Server-Side
Function

 JavaScript



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