๐ŸŽ๏ธ Racing๐Ÿ”Œ Integrations๐Ÿ“… Events๐Ÿ•ด๏ธ ClientraceStarted

nx_racing:server:raceStarted Event Listener Guide

The nx_racing:server:raceStarted event is a client-side event that informs the player when a race begins. This event provides detailed race information, such as track details, lap count, and player-specific data.

โš ๏ธ

The nx_racing:server:raceStarted event is internal to the racing system and should NEVER be triggered by other scripts.


Event Listener Setup

To capture this event in your client script, use the following event handler:

AddEventHandler('nx_racing:server:raceStarted', function(raceDetails)
    -- Handle the event using the `raceDetails` data.
end)

Event Data Structure

The raceDetails object contains the following fields:

  • raceId (string): Unique identifier for the race.
  • trackName (string): Name of the track where the race is taking place.
  • trackType (string): Type of track, either "circuit" or "sprint".
  • raceLaps (number): Total number of laps for the race (applicable for "circuit" tracks).
  • raceDistance (number): Total distance of the race.
  • camera (string): Camera setting, either "unset" (player decides) or "first" (forced first-person).
  • phasingOn (boolean): Indicates if collision phasing is enabled during the race.
  • phasingTime (number): Duration of collision phasing in seconds (if enabled).
  • vehicle (number): Playerโ€™s vehicle Entity ID.