OnPlayerEnterCheckpoint
From GTA Network Wiki
![]() |
![]() |
![]() |
---|
Event triggered when a player enters a checkpoint
Server-side
Subscribing
Note: the Attribute should be declared above the method to be invoked, it's alternative to subscribing the method to a delegate, introduced for performance reasons.
[ServerEvent(Event.PlayerEnterCheckpoint)]
Method Syntax
void OnPlayerEnterCheckpoint(Checkpoint checkpoint, Client player)
Required Parameters
- Checkpoint: the checkpoint.
- Client: the player.
Usage example(s)
[ServerEvent(Event.PlayerEnterCheckpoint)] public void OnPlayerEnterCheckpoint(Checkpoint checkpoint, Client player) { // Some code.. }
Client-side
Subscribing
Note: the method should be subscribed to the respective event delegate in your Main constructor/Entry point for it to be invoked.
public Main() { Events.OnPlayerEnterCheckpoint += OnPlayerEnterCheckpoint; }
Method Syntax
void OnPlayerEnterCheckpoint(Checkpoint checkpoint, CancelEventArgs cancel)
Required 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 entered.
public void OnPlayerEnterCheckpoint(RAGE.Elements.Checkpoint checkpoint, RAGE.Events.CancelEventArgs cancel) { Vector3 pos = checkpoint.Position; RAGE.Chat.Output($"Player just entered the checkpoint at X{pos.X} Y{pos.Y} Z{pos.Z}"); }