PlayerJoin

From RAGE Multiplayer Wiki
Revision as of 09:29, 29 November 2018 by Sake (talk | contribs)

Server-Side
Event

 C#  JavaScript



This event is triggered when a player joins the server.

JavaScript Syntax

NOTE: This event is not called for the local player who joined the server (when it's used in client-side).

Parameters

  • player: The player who joined.

Example

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!`);
});


Client-Side Event

 C#  JavaScript


C# Syntax

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 for a player and hides the browser when it is created.

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


JavaScript Syntax

Same as serverside