OnPlayerJoined: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Since the event doesn't exist client-side, I made it server-side only. I also added an example) |
||
Line 1: | Line 1: | ||
{{ScriptItem | {{ScriptItem | ||
|endpoint = | |endpoint = server | ||
|type = event | |type = event | ||
|name = onPlayerJoined | |name = onPlayerJoined | ||
Line 8: | Line 8: | ||
|parameter1 = Client client The client that has connected to the server. | |parameter1 = Client client The client that has connected to the server. | ||
|notes = {{Shared/PlayerConnectionEvents}} | |notes = {{Shared/PlayerConnectionEvents}} | ||
|exampleJSSS = | |||
addEventHandler('OnPlayerJoined', (event, client) => { | |||
messageClient(`Hello ${client.name}, welcome to my server! 👋`, client, COLOUR_YELLOW); | |||
}); | |||
}} | }} |
Revision as of 15:06, 12 August 2021
Event
Server Only
Online and Offline
Not Cancellable
Available since Server 1.0.0
function(Event event, Client client)
The onPlayerJoined event is invoked when a player has connected to the server.
Parameters
1) | Event | event | The event object for this event. |
2) | Client | client | The client that has connected to the server. |
Attributes
const | This event cannot be cancelled. |
Notes
- The chronological order of player connection events are:# OnPlayerConnect.
- # OnPlayerJoin.
- # OnPlayerJoined.
- .
Examples
Example 1 - JavaScript - Server-Side:
addEventHandler('OnPlayerJoined', (event, client) => { messageClient(`Hello ${client.name}, welcome to my server! 👋`, client, COLOUR_YELLOW); });
Compatibility
There isn't any compatibility information for this event.
Related
Server Related
OnPlayerChat
OnPlayerCommand
OnPlayerConnect
OnPlayerJoin
OnPlayerJoined
OnPlayerQuit