NexureNexure
Racing SystemIntegrationsExports

Server

Create races, inspect live data, and read racer records via exports.

These exports keep custom logic in sync with Nexure Racing. Mix and match them to automate scheduling, power scoreboard bots, or drive framework integrations.

nx_racing.createRace

exports.nx_racing:createRace(data)

data is a table describing the race:

FieldTypeDescription
tracktable{ random = boolean, verified = boolean, trackId = number } lets you pick a random verified track or a specific ID.
lapsnumberNumber of laps.
startTimenumberMilliseconds until the race starts.
phasingOnbooleanEnable collision phasing.
phasingTimenumberDuration of phasing in milliseconds.
buyInnumberEntry fee (0 for free).
camerastring"unset" or "first" to control enforcement.
classnumber0 for all classes, otherwise index from Config.vehicleClasses.classes.
moneyPrizenumberPrize pool (0 for unranked).
raceTypestring"ranked" or "unranked"; ranked races require a moneyPrize.
-- Random verified ranked race
exports.nx_racing:createRace({
  track = { random = true, verified = true },
  laps = 5,
  startTime = 10_000,
  phasingOn = true,
  phasingTime = 15_000,
  buyIn = 500,
  camera = 'unset',
  class = 0,
  moneyPrize = 10_000,
  raceType = 'ranked'
})

-- Unranked race on a specific track
exports.nx_racing:createRace({
  track = { random = false, trackId = 12 },
  laps = 3,
  startTime = 5_000,
  phasingOn = false,
  phasingTime = 0,
  buyIn = 0,
  camera = 'first',
  class = 1,
  moneyPrize = 0,
  raceType = 'unranked'
})

nx_racing.getActiveRaces

local activeRaces = exports.nx_racing:getActiveRaces()

Returns a table (possibly empty) of open or in-progress races:

FieldTypeDescription
raceIdnumberUnique race identifier.
trackIdnumberTrack identifier.
statusnumber0 = open for participants, 1 = running.
local races = exports.nx_racing:getActiveRaces()

if #races == 0 then
  print('No active races')
else
  for _, race in ipairs(races) do
    print(('Race %d on track %d (status %d)'):format(race.raceId, race.trackId, race.status))
  end
end

nx_racing.getOngoingRaceData

local raceData = exports.nx_racing:getOngoingRaceData(raceId)

Returns false if the race does not exist or has finished.

FieldTypeDescription
statusnumberRace status.
createdTimenumberTimestamp of creation.
raceTypestringe.g. timeTrial, circuit.
moneyPrizenumberPrize pool.
trackIdnumberTrack identifier.
trackNamestringTrack name.
trackTypestringTrack type.
trackLapsnumberLap count.
tracktableTrack metadata.
phasingOnbooleanPhasing enabled.
phasingTimenumberPhasing duration in seconds.
checkpointstableCheckpoint data.
playerstableDetailed racer entries.
playerListtablePlayer identifiers.
buyInnumberEntry fee.
camerabooleanWhether a forced camera was set.
classnumberAllowed class.
totalRaceDistancenumberDistance in meters.
local details = exports.nx_racing:getOngoingRaceData(123)

if details then
  print(('Track: %s (%d racers)'):format(details.trackName, #details.players))
else
  print('Race not found or already finished')
end

nx_racing.getRacer

local racer = exports.nx_racing:getRacer(source)
  • source (number): Player server ID.

Returns false if the player cannot be resolved.

FieldTypeDescription
idnumberRacing ID.
namestringDisplay name.
avatarstringAvatar URL.
mmrnumberCurrent ranking MMR.
local racer = exports.nx_racing:getRacer(source)
if racer then
  print(('Racer %s has %d MMR'):format(racer.name, racer.mmr))
else
  print('Player not registered')
end

nx_racing.getRacerById

local racer = exports.nx_racing:getRacerById(racerId)
  • racerId (number): Racing ID assigned by Nexure Racing.

Returns false if no racer matches.

FieldTypeDescription
sourcenumberCurrent server source (if online).
idnumberRacer ID.
namestringDisplay name.
avatarstringAvatar URL.
mmrnumberMatchmaking rating.
local racer = exports.nx_racing:getRacerById(12345)
if racer then
  print(('Player %s (source %s)'):format(racer.name, racer.source))
else
  print('No racer with that ID')
end

nx_racing.getRacerByIdentifier

local racer = exports.nx_racing:getRacerByIdentifier(identifier)
  • identifier (string): Framework identifier stored by the racing system.

Returns false if the identifier cannot be found.

FieldTypeDescription
idnumberRacer ID.
namestringPlayer name.
avatarstringAvatar URL.
mmrnumberMatchmaking rating.
local racer = exports.nx_racing:getRacerByIdentifier('player_123')
if racer then
  print(('MMR: %d'):format(racer.mmr))
else
  print('Identifier not registered')
end

Uses MySQL.single.await, so keep identifier lookups efficient.

On this page