Player::notify: Difference between revisions

From RAGE Multiplayer Wiki
mNo edit summary
m (Replaced HTML with template)
 
Line 14: Line 14:
== Example ==
== Example ==
Creates a command to let the player enter a message which will then come up as a notification.
Creates a command to let the player enter a message which will then come up as a notification.
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;">
{{ServersideCode|
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
<pre>
<pre>
mp.events.addCommand('notify', (player, message) => {
mp.events.addCommand('notify', (player, message) => {
Line 22: Line 21:
});
});
</pre>
</pre>
</div>
}}


==See Also==
==See Also==
{{Player_block}}
{{Player_block}}

Latest revision as of 11:38, 26 October 2018

This function sends a notification to the player.

You can use the colour codes found here: Fonts and colors

Syntax

player.notify(message)

Parameters

  • message - String

Example

Creates a command to let the player enter a message which will then come up as a notification.

Server-Side
mp.events.addCommand('notify', (player, message) => {
	if(!message) return player.outputChatBox("You need to enter a message.");
	player.notify(message);
});

See Also