EvonexEvonex
🏎️ Racing System

👜 State Bags

Player state bags exposed by Evonex Racing

Evonex Racing exposes FiveM state bags on the local player. Use these in other scripts to check whether a player is in a race and to get the current race ID.

All state bags are client-side and attached to LocalPlayer.state.

inRace (boolean)

true when the player is in an active race, nil or false otherwise. Use this to block actions (e.g. teleport, inventory) during a race.

local inRace = LocalPlayer.state.inRace

if inRace then
  print('Player is currently in an active race')
end

raceId (number)

The ID of the race the player is in. Set when the player joins a race and cleared when they leave. Use this to link other features (e.g. bets, leaderboard) to the current race.

local raceId = LocalPlayer.state.raceId

if raceId then
  print(('Player is in race with ID: %d'):format(raceId))
end

Example: restrict command during race

RegisterCommand("mycommand", function()
  if LocalPlayer.state.inRace then
    print('Cannot use this command while racing')
    return
  end

  -- Your command logic here
end, false)