Player::notify: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
m (Cleaned up page, added example.)
Line 1: Line 1:
This function sends notification message for player.
__NOTOC__
This function sends a notification to the player.


'''Codes:'''
'''Codes:'''


~n~ New line
*'''~n~''' New line
*'''~r~''' Red
*'''~g~''' Green
*'''~b~''' Blue
*'''~w~''' or ~s~ White
*'''~y~''' Yellow
*'''~p~''' Purple
*'''~l~''' Black (lower case L)


~r~ Red
== Syntax ==
<pre>
player.notify(message)
</pre>


~g~ Green
=== Parameters ===
 
*'''message''' - {{RageType|String}}
~b~ Blue
 
~w~ or ~s~ White
 
~y~ Yellow
 
~p~ Purple
 
~l~ Black (lower case L)
 
== Syntax ==
<syntaxhighlight lang="javascript">
player.notify(String message)
</syntaxhighlight>


== Example ==
== Example ==
 
Creates a command to let the player enter a message which will then come up as a notification.
<syntaxhighlight lang="javascript">
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;">
player.notify('~w~Hello ~n~~g~World~w~')
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
</syntaxhighlight>
<pre>
mp.events.addCommand('notify', (player, message) => {
if(!message) return player.outputChatBox("You need to enter a message.");
player.notify(message);
});
</pre>
</div>


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

Revision as of 12:38, 29 September 2018

This function sends a notification to the player.

Codes:

  • ~n~ New line
  • ~r~ Red
  • ~g~ Green
  • ~b~ Blue
  • ~w~ or ~s~ White
  • ~y~ Yellow
  • ~p~ Purple
  • ~l~ Black (lower case L)

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