PlayerJoin: Difference between revisions
No edit summary |
|||
| Line 1: | Line 1: | ||
{{Shared}} | |||
This event is triggered when a player joins the server. | This event is triggered when a player joins the server. | ||
'''NOTE: ''' This event is not called for the local player who joined the server (when it's used in client-side). | |||
== Syntax == | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
mp.events.add('playerJoin', player => { | |||
//do stuff here | |||
}); | |||
</syntaxhighlight> | |||
=== Attributes === | |||
* '''player''': The player who joined. | |||
== Examples == | |||
This is a basic explanation about what does the example below do. | |||
<syntaxhighlight lang="javascript"> | |||
mp.events.add('playerJoin', player => { | |||
mp.gui.chat.push(`[SERVER]: ${player.name} has joined the server!`); | |||
}); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 19:33, 23 August 2018
Shared
This event is triggered when a player joins the server.
NOTE: This event is not called for the local player who joined the server (when it's used in client-side).
Syntax
mp.events.add('playerJoin', player => {
//do stuff here
});
Attributes
- player: The player who joined.
Examples
This is a basic explanation about what does the example below do.
mp.events.add('playerJoin', player => {
mp.gui.chat.push(`[SERVER]: ${player.name} has joined the server!`);
});