Server API
registerGarage
Register a garage with server-side access checks from another resource.
local garageId, err = exports["jg-advancedgarages"]:registerGarage(options)| Returns | Type | Description |
|---|---|---|
garageId | string | false | Garage ID to use with the other exports, or false on failure |
err | string? | Error code on failure |
| Parameter | Type | Required | Description |
|---|---|---|---|
options | table | Yes | Garage settings containing the fields below |
options.id | string | Yes | Unique key within your resource. Use letters, numbers, underscores, hyphens or dots |
options.name | string | Yes | Garage name shown to players |
options.access | false | string[] | function | Yes | false 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.coords | vector3 | table | Yes | Garage entrance. Tables use x, y and z |
options.spawnPoints | vector4[] | table[] | Yes | Vehicle spawn positions. At least one is required; w is the heading |
options.vehicleType | string | No | "car", "air" or "sea". Defaults to "car" |
options.storeCoords | vector3 | table | No | Parking position. Defaults to options.coords |
options.distance | number | No | Maximum distance for opening or storing, in metres. Defaults to 15 |
options.routingBucket | integer | No | Routing bucket for opening and storing. Defaults to 0 |
options.manageInteractions | boolean | No | Defaults to true, which creates the open and store interactions. Set false to use your own prompts with the Client API |
options.blip | table | No | Managed blip settings: enabled, id, color, scale and unique. Disabled by default |
options.markers | table | No | Managed 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.
local success, err = exports["jg-advancedgarages"]:updateGarage(garageId, options)| Returns | Type | Description |
|---|---|---|
success | boolean | Whether the update succeeded; invalid options leave the garage unchanged |
err | string? | Validation error, or not_registered_by_resource if this resource doesn't own the registration |
| Parameter | Type | Required | Description |
|---|---|---|---|
garageId | string | Yes | ID returned by registerGarage for a garage registered by this resource |
options | table | Yes | Complete 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.
local success = exports["jg-advancedgarages"]:unregisterGarage(garageId)| Returns | Type | Description |
|---|---|---|
success | boolean | true if removed; false if this resource doesn't own the registration |
| Parameter | Type | Required | Description |
|---|---|---|---|
garageId | string | Yes | ID 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.
local success = exports["jg-advancedgarages"]:refreshGarageAccess(garageId)| Returns | Type | Description |
|---|---|---|
success | boolean | Whether a refresh was requested for a garage registered by this resource |
| Parameter | Type | Required | Description |
|---|---|---|---|
garageId | string | Yes | ID 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.
local garages = exports["jg-advancedgarages"]:getAllGarages()| Returns | Type | Description |
|---|---|---|
garages | table[] | Garage and impound entries |
entry.name | string | Garage ID |
entry.label | string | Garage ID |
entry.type, entry.vehicle | string | Vehicle type: "car", "air" or "sea" |
entry.takeVehicle, entry.putVehicle | vector3 | table | Garage entrance position |
entry.spawnPoint | table | Vehicle spawn positions |
entry.showBlip | boolean | Whether the garage has a blip |
entry.blipName | string | Garage ID |
entry.blipNumber, entry.blipColor | number | Blip 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.
exports["jg-advancedgarages"]:registerVehicleOutside(plate, netId)| Parameter | Type | Required | Description |
|---|---|---|---|
plate | string | Yes | Vehicle number plate |
netId | integer | Yes | Vehicle network ID, not an entity handle |
deleteOutsideVehicle
Delete a vehicle tracked as outside by Advanced Garages, using its plate.
exports["jg-advancedgarages"]:deleteOutsideVehicle(plate)| Parameter | Type | Required | Description |
|---|---|---|---|
plate | string | Yes | Number plate of the vehicle tracked as outside |
Last updated 18 September 2026