PlayerSpawn

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

This event is triggered when a player spawns.

Server-Side
Event

C.png C# Js.png JavaScript




C# Syntax
C.png


JavaScript Syntax
Jslogo.png

Parameters

  • player: Player - player, which has spawned

Example

This example outputs a console chat message, when a player spawns.

  function playerSpawn(player) {
    console.log(`${player.name} has spawned`);
  }

  mp.events.add("playerSpawn", playerSpawn);


Client-Side Event

C.png C# Js.png JavaScript



C# Syntax
C.png

public delegate void OnPlayerSpawnDelegate(CancelEventArgs cancel);

Parameters

  • cancel: cancel, expects RAGE.Events.CancelEventArgs type.

Example

The example below shows a chat message to the client when they spawn.

Events.OnPlayerSpawn += OnPlayerSpawn;
public void OnPlayerSpawn(RAGE.Events.CancelEventArgs cancel)
{
     RAGE.Chat.Output($"You just spawned");
}


JavaScript Syntax
Jslogo.png

Example

This example outputs a console chat message to the client when they spawns.

mp.events.add("playerSpawn", () => {
     mp.gui.chat.push("You just spawned");
});


See also

Checkpoint

Colshape

Entity

Player

Streaming

Vehicle

Waypoint