PlayerExitCheckpoint
Event triggered when a player leaves a checkpoint
Server-Side Event
C# | JavaScript |
---|
C# Syntax
[ServerEvent(Event.PlayerExitCheckpoint)]
Parameters
- checkpoint: parameter input should be in Checkpoint type
- player: parameter input should be in Player type
Example
[ServerEvent(Event.PlayerExitCheckpoint)]
public void OnPlayerExitCheckpoint(Checkpoint checkpoint, Player player)
{
player.SendChatMessage($"You exited checkpoint: {checkpoint.Id}.");
}
JavaScript Syntax
mp.events.add("playerExitCheckpoint", eventHandler);
eventHandler expects a function with:
Parameters
- player: Player - The player who exited checkpoint.
- checkpoint: Checkpoint - The checkpoint that player exited.
Example
mp.events.add("playerExitCheckpoint", (player, checkpoint) => {
// Do what you want.
});
Client-Side Event
C# | JavaScript |
---|
C# Syntax
public delegate void OnPlayerExitCheckpointDelegate(Checkpoint checkpoint, CancelEventArgs cancel);
Parameters
- checkpoint: checkpoint, expects RAGE.Elements.Checkpoint type.
- cancel: cancel, expects RAGE.Events.CancelEventArgs type.
Example
The example below shows a message to player with the position of the checkpoint they just exited.
Events.OnPlayerExitCheckpoint += OnPlayerExitCheckpoint;
public void OnPlayerExitCheckpoint(RAGE.Elements.Checkpoint checkpoint, RAGE.Events.CancelEventArgs cancel)
{
Vector3 pos = checkpoint.Position;
RAGE.Chat.Output($"Player just left the checkpoint at X{pos.X} Y{pos.Y} Z{pos.Z}");
}
JavaScript Syntax
Parameters
- checkpoint: Checkpoint
Example
mp.events.add("playerExitCheckpoint", (checkpoint) => {
// Do what you want.
});