JG Docs
Advanced Garages

Server API

registerGarage

Register a garage with server-side access checks from another resource.

server.lua
local garageId, err = exports["jg-advancedgarages"]:registerGarage(options)
ReturnsTypeDescription
garageIdstring | falseGarage ID to use with the other exports, or false on failure
errstring?Error code on failure
ParameterTypeRequiredDescription
optionstableYesGarage settings containing the fields below
options.idstringYesUnique key within your resource. Use letters, numbers, underscores, hyphens or dots
options.namestringYesGarage name shown to players
options.accessfalse | string[] | functionYesfalse allows anyone. An identifier list allows those characters only; an empty list allows nobody. A callback receives (source, garageId) and must return true to allow access
options.coordsvector3 | tableYesGarage entrance. Tables use x, y and z
options.spawnPointsvector4[] | table[]YesVehicle spawn positions. At least one is required; w is the heading
options.vehicleTypestringNo"car", "air" or "sea". Defaults to "car"
options.storeCoordsvector3 | tableNoParking position. Defaults to options.coords
options.distancenumberNoMaximum distance for opening or storing, in metres. Defaults to 15
options.routingBucketintegerNoRouting bucket for opening and storing. Defaults to 0
options.manageInteractionsbooleanNoDefaults to true, which creates the open and store interactions. Set false to use your own prompts with the Client API
options.bliptableNoManaged blip settings: enabled, id, color, scale and unique. Disabled by default
options.markerstableNoManaged marker settings: id, size, color, bobUpAndDown, faceCamera, rotate and drawOnEnts

Access lists use character identifiers: citizenid on QBCore/Qbox and identifier on ESX. For housing, use a callback that checks current ownership or keys on the server. Callback errors and any return value other than true deny access.

Register each garage when your resource starts. Registrations aren't saved to the database and are removed when either resource stops. The returned ID includes your resource name; keep that name and your id unchanged across restarts so stored vehicles remain linked.

See Registering Garages for the integration flow.

updateGarage

Replace the options for a garage registered by the calling resource.

server.lua
local success, err = exports["jg-advancedgarages"]:updateGarage(garageId, options)
ReturnsTypeDescription
successbooleanWhether the update succeeded; invalid options leave the garage unchanged
errstring?Validation error, or not_registered_by_resource if this resource doesn't own the registration
ParameterTypeRequiredDescription
garageIdstringYesID returned by registerGarage for a garage registered by this resource
optionstableYesComplete registration options, not only changed fields. options.id is ignored; the garage ID stays the same

Refreshes player interactions after updating. See Registering Garages.

unregisterGarage

Remove a garage registered by the calling resource without deleting its stored vehicles.

server.lua
local success = exports["jg-advancedgarages"]:unregisterGarage(garageId)
ReturnsTypeDescription
successbooleantrue if removed; false if this resource doesn't own the registration
ParameterTypeRequiredDescription
garageIdstringYesID returned by registerGarage for a garage registered by this resource

Register the same ID again to make its vehicles available. See Registering Garages.

refreshGarageAccess

Refresh visible interactions after the ownership or keys used by an access callback change.

server.lua
local success = exports["jg-advancedgarages"]:refreshGarageAccess(garageId)
ReturnsTypeDescription
successbooleanWhether a refresh was requested for a garage registered by this resource
ParameterTypeRequiredDescription
garageIdstringYesID returned by registerGarage for a garage registered by this resource

Access is checked whenever players use the garage, even before this refresh. See Registering Garages.

getAllGarages

Get garage and impound locations for use by another resource.

server.lua
local garages = exports["jg-advancedgarages"]:getAllGarages()
ReturnsTypeDescription
garagestable[]Garage and impound entries
entry.namestringGarage ID
entry.labelstringGarage ID
entry.type, entry.vehiclestringVehicle type: "car", "air" or "sea"
entry.takeVehicle, entry.putVehiclevector3 | tableGarage entrance position
entry.spawnPointtableVehicle spawn positions
entry.showBlipbooleanWhether the garage has a blip
entry.blipNamestringGarage ID
entry.blipNumber, entry.blipColornumberBlip icon and colour

registerVehicleOutside

Track a vehicle spawned by another resource so it can't be retrieved from a garage again while it's outside.

server.lua
exports["jg-advancedgarages"]:registerVehicleOutside(plate, netId)
ParameterTypeRequiredDescription
platestringYesVehicle number plate
netIdintegerYesVehicle network ID, not an entity handle

deleteOutsideVehicle

Delete a vehicle tracked as outside by Advanced Garages, using its plate.

server.lua
exports["jg-advancedgarages"]:deleteOutsideVehicle(plate)
ParameterTypeRequiredDescription
platestringYesNumber plate of the vehicle tracked as outside

Last updated 18 September 2026

On this page