PlayerJoin

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

This event is triggered when a player joins the server.

Server-Side
Event

Js.png JavaScript




C# Syntax
C.png


Parameters

JavaScript Syntax
Jslogo.png

Parameters

  • player: Player - The player who joined.

Example

mp.events.add('playerJoin', (player) => {
    console.log(`[SERVER]: ${player.name} has joined the server!`);
});


Client-Side Event

C.png C# Js.png JavaScript


This event is not called for the local player who joined the server.


C# Syntax
C.png

public delegate void OnPlayerJoinDelegate(Player player);

Parameters

  • player: The player joining the server, expects RAGE.Elements.Player type.

Example

The example below shows up a message to the client when another player joins the server.

Events.OnPlayerJoin += OnPlayerJoin;
public void OnPlayerJoin(RAGE.Elements.Player player)
{
    RAGE.Chat.Output($"Player {player.Name} has joined");
}


JavaScript Syntax
Jslogo.png

Parameters

  • player: Player - Another player who joined the server.

Example

mp.events.add("playerJoin", (player) => {
    mp.gui.chat.push(`${player.name} has joined the server!`);
});


See also

Checkpoint

Colshape

Entity

Player

Streaming

Vehicle

Waypoint