Player::notify: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
m (Replaced HTML with template)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This function sends notify message for player.
__NOTOC__
This function sends a notification to the player.
 
You can use the colour codes found here: [[Fonts_and_Colors|Fonts and colors]]
 
== 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 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