Difference between revisions of "Player::outputChatBox"

From RAGE Multiplayer Wiki
Jump to navigation Jump to search
Line 3: Line 3:
== Syntax ==
== Syntax ==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
player.outputChatBox(String text);

Latest revision as of 09:55, 1 December 2019

This functions writes a chat message to player.



Required Arguments

  • text: String Text what should be output in player chat.

Example #1

This example welcomes player on connect.

	player => {
		player.outputChatBox(`Welcome to the server, ${player.name}!`);

Example #2

This example just output color texts. Note: chat.colors property should be enabled - if you wanna use that.

let red = `#ff0000`;
let player = mp.players.at(1337); // 1337 is a player id
if (player) {
	player.outputChatBox(`!{#dddddd}This is Grey! !{#ffffff}This is White! !{${red}}This is Red!`);
	player.outputChatBox(` !{255, 0, 0}This is too Red! !{green}This is Green! !{255, 0, 255, 0.5}This is opacity Pink!`);

See also