Player::outputChatBox: Difference between revisions

From RAGE Multiplayer Wiki
m (Added colour example to chat)
m (Added use of variables)
Line 15: Line 15:
   player.outputChatBox('Welcome to the server, ' + player.name + '!');
   player.outputChatBox('Welcome to the server, ' + player.name + '!');
   // Example of colours in chat:
   // Example of colours in chat:
   player.outputChatBox(`!{#dddddd}This is Grey! !{#ffffff}This is White!`);
  var red = "#ff0000"
   player.outputChatBox(`!{#dddddd}This is Grey! !{#ffffff}This is White! !{red} This is Red!`);
});
});
</syntaxhighlight>
</syntaxhighlight>

Revision as of 10:07, 26 September 2017

This functions writes a chat message to player.

Syntax

player.outputChatBox(reason);

Arguments

  • reason - string

Example

This example welcomes player on connect.

mp.events.add('playerJoin', player => {
  player.outputChatBox('Welcome to the server, ' + player.name + '!');
  // Example of colours in chat:
  var red = "#ff0000"
  player.outputChatBox(`!{#dddddd}This is Grey! !{#ffffff}This is White! !{red} This is Red!`);
});

See Also