Exports

Exports other scripts use to open the Racing tablet and to give, take and check a racer's race cars.

Race cars live in a racer's racing garage. Another script can put one there, take one away, or check for room first. The exports are server side and sit in gg_racing/core/open/server/exports.lua, which is never encrypted, so you can read exactly what they do.

racer is a player's server id (a number) or their framework identifier (the citizenid on QBCore and Qbox, the identifier on ESX). A refusal comes back as nil or false plus a reason, a key from locales/en.json.

ExportReturns
GetRaceCarSpace(racer){ cars, max, trays, free, canAdd }
CanAddRaceCar(racer)true, or false, reason
AddRaceCar(racer, model, options?)The car, or nil, reason. Options: label, class, source, value, props, force.
RemoveRaceCar(racer, carId)true, or false, reason. Never the car on the mechanic bay or one in a race.
GetRaceCars(racer)Every race car the racer owns.
GetRaceCar(carId)One car with its owner, or nil.

A racer keeps only the cars their lift trays hold, three to a lift, so canAdd needs a free tray.

Lua
local space = exports.gg_racing:GetRaceCarSpace(source)
if space.canAdd then
    local car, reason = exports.gg_racing:AddRaceCar(source, "sultanrs", { source = "boost" })
end

Other Scripts Add Race Cars under Marketplace in /ggsettings turns AddRaceCar and RemoveRaceCar off for the whole server.

Opening the tablet

A phone app, a laptop, a radial menu or a job can open the Racing tablet for a player, the same as using the tablet item.

SideCallDoes
Clientexports.gg_racing:OpenUI()Opens the tablet.
Clientexports.gg_racing:CloseUI()Closes it.
ServerTriggerClientEvent('gg_racing:client:useTablet', source)Opens it on that player's game.

From 1.0.9 there is also:

SideCallDoes
Clientexports.gg_racing:ToggleUI()Opens it, or closes it if it is up.
Clientexports.gg_racing:IsUIOpen()true while it is up.
ServerTriggerClientEvent('gg_racing:client:openUI', source)Opens it on that player's game.
ServerTriggerClientEvent('gg_racing:client:closeUI', source)Closes it.
ServerTriggerClientEvent('gg_racing:client:toggleUI', source)Opens or closes it.
Lua
-- client: a button in a phone app
exports.gg_racing:OpenUI()
Lua
-- server: open it for a player
TriggerClientEvent('gg_racing:client:useTablet', source)

Support

Questions before you buy?

Ask the team in our Discord before you pay a thing. Setup help, update notes, giveaways and discount codes, all in one place.

1,085 online now2,308 members