Exports
Server exports other scripts use 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.
| Export | Returns |
|---|---|
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.
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.
