Player::notify: Difference between revisions

From RAGE Multiplayer Wiki
m (Cleaned up page, added example.)
m (Replaced HTML with template)
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
This function sends a notification to the player.
This function sends a notification to the player.


'''Codes:'''
You can use the colour codes found here: [[Fonts_and_Colors|Fonts and colors]]
 
*'''~n~''' New line
*'''~r~''' Red
*'''~g~''' Green
*'''~b~''' Blue
*'''~w~''' or ~s~ White
*'''~y~''' Yellow
*'''~p~''' Purple
*'''~l~''' Black (lower case L)


== Syntax ==
== Syntax ==
Line 23: 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 31: 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