Player::notify: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
m (Replaced HTML with template)
 
(4 intermediate revisions by 2 users 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
~r~ Red
~g~ Green
~b~ Blue
~w~ or ~s~ White
~y~ Yellow
~p~ Purple
~l~ Black (lower case L)


== Syntax ==
== Syntax ==
<syntaxhighlight lang="javascript">
<pre>
player.notify(String message)
player.notify(message)
</syntaxhighlight>
</pre>
 
=== Parameters ===
*'''message''' - {{RageType|String}}


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