Player::notify: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
m (Replaced HTML with template)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
This function sends notification message for player.
__NOTOC__
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
== Syntax ==
 
<pre>
~r~ Red
player.notify(message)
 
</pre>
~g~ Green
 
~b~ Blue
 
~w~ or ~s~ White
 
~y~ Yellow


~p~ Purple
=== Parameters ===
 
*'''message''' - {{RageType|String}}
~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">
{{ServersideCode|
player.notify('~w~Hello ~n~~g~World~w~')
<pre>
</syntaxhighlight>
mp.events.addCommand('notify', (player, message) => {
if(!message) return player.outputChatBox("You need to enter a message.");
player.notify(message);
});
</pre>
}}


==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