Exports
Client and server exports and state bags for gs_racing.
Use these from other resources to open GS Racing or check whether a player is racing, in a lobby, or building a track.
Client
openRacingTablet
Opens GS Racing for the local player.
exports['gs_racing']:openRacingTablet()IsInRace
Returns true while the local player is in an active race session (countdown through finish / cleanup).
if exports['gs_racing']:IsInRace() then
-- block other activities, hide markers, etc.
endGetActiveRace
Returns a snapshot of the local race, or nil when not racing.
local race = exports['gs_racing']:GetActiveRace()
if race then
print(race.raceId, race.mode, race.trackName, race.place, race.field)
endFields: raceId, mode, laps, lap, checkpoint, started, finished, trackName, vehicleKind, place, field, requiredClass.
IsInLobby
Returns true when the player has joined an open/scheduled lobby and is not yet in the active race session.
if exports['gs_racing']:IsInLobby() then
-- waiting at the start line
endGetJoinedRaceId
Returns the joined race id, or false when not in a lobby / race grid.
local raceId = exports['gs_racing']:GetJoinedRaceId()
if raceId then
print('Joined race', raceId)
endIsCreatingTrack
Returns true while the local player is in track builder (creator) mode.
if exports['gs_racing']:IsCreatingTrack() then
-- disable conflicting controls / jobs
endGetCreatorStatus
Returns the builder status table (same shape as the NUI creator status).
local status = exports['gs_racing']:GetCreatorStatus()
if status.active then
print(status.step, status.racePoints, status.canSave)
endUseful fields: active, name, type, vehicleKind, step, stepLabel, hasStart, hasFinish, racePoints, totalPoints, objectCount, canSave.
Server
openRacingTablet
Opens GS Racing for a player.
exports['gs_racing']:openRacingTablet(source)IsInRace
Returns true when the player’s participant status is RACING (countdown / live race).
if exports['gs_racing']:IsInRace(source) then
-- deny other server actions
endIsInLobby
Returns true when the player is joined to a lobby (JOINED) and not yet racing.
if exports['gs_racing']:IsInLobby(source) then
-- waiting in lobby
endGetPlayerRace
Returns a participation summary, or nil when the player is idle.
local info = exports['gs_racing']:GetPlayerRace(source)
if info then
print(info.phase, info.raceId, info.trackName, info.mode)
endFields: raceId, trackId, trackName, mode, laps, vehicleClass, raceStatus, participantStatus, phase ('lobby' or 'race').
GetSkillWinBonusPercent
Skill-based win bonus % used for podium payouts. See Economy & permissions.
local pct = exports['gs_racing']:GetSkillWinBonusPercent(source)State bags
LocalPlayer.state.inActiveRace
| Bag | Local player |
| Key | inActiveRace |
| Type | boolean |
| Replicated | No (set(..., false)) — only the owning client can read it |
| When true | From race countdown start through finish / cancel / forfeit cleanup |
| When false / unset | Idle, lobby, or builder |
Same meaning as the client IsInRace export. Useful for lightweight local checks (e.g. fuel scripts) without calling into gs_racing.
-- client (local player only)
if LocalPlayer.state.inActiveRace then
-- in active race session
end
AddStateBagChangeHandler('inActiveRace', ('player:%s'):format(cache.serverId), function(_, _, value)
print('inActiveRace', value == true)
end)Because the bag is not replicated, other clients and the server cannot read Player(id).state.inActiveRace. Use the server exports (IsInRace, GetPlayerRace) for authoritative checks.
There are no other state bags owned by gs_racing (no lobby / builder bags, no entity bags).
Related hooks
Not exports, but useful owner hooks in server/edit.lua:
ResolveVehicleClass(model)HasIllegalTune(plate)OnRacingRepChanged(identifier, delta, total)OnRacingAnnouncement(announcement)— auto races / meetups → phone mail, push, etc.OnPoliceRaceDispatch(alert)
See server/edit.lua.
