Players::broadcastInRange

From RAGE Multiplayer Wiki
Revision as of 13:02, 17 April 2017 by CocaColaBear (talk | contribs) (Created page with "This function writes a chat message for all players in range (like Player::outputChatBox). ==Syntax== <syntaxhighlight lang="typescript"> void players.broadcastInRange(Ve...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function writes a chat message for all players in range (like Player::outputChatBox).

Syntax

void players.broadcastInRange(Vecto3 position, number range [, number dimension], string text);

Required Arguments

  • text: The text to be sent.
  • position: The position from which the broadcast will be sent.

Optional Arguments

  • dimension: The dimension in which the broadcast will be sent.

Example

This example sends message to all players in 15 units from the player

mp.events.addCommand("say", (player, message) => {
	let pos = player.position;

	mp.players.broadcastInRange(pos, 15, `Message from ${player.name}: ${message}`);

});

See Also