zephyr_garagesExportsServer

Server Exports

All exports are available server-side from any resource:

exports.zephyr_garages:ExportName(...)

GetGarages

Returns the full table of all currently registered garages, keyed by garage name.

local garages = exports.zephyr_garages:GetGarages()
 
for name, garage in pairs(garages) do
    print(name, garage.label, garage.vehicleType)
end

Returns: table<string, GarageConfig> — all garages registered at the time of the call.


RegisterGarage

Registers a new garage or updates an existing one at runtime. After registration, all connected clients automatically receive the new access points and blips — no restart required.

exports.zephyr_garages:RegisterGarage('sandy_pd', {
    label        = 'Sandy PD',
    vehicleType  = 'car',
    groups       = 'police',
    accessPoints = {
        {
            blip   = { name = 'Sandy PD Garage', sprite = 357, color = 38 },
            coords = vec4(1853.06, 3686.55, 34.27, 210.0),
            spawn  = vec4(1857.33, 3690.12, 34.27, 28.0),
        },
    },
})
ParameterTypeDescription
namestringUnique garage identifier (used as table key)
garageConfigtableGarage configuration — same structure as config.server.garages entries

garageConfig fields:

FieldTypeDescription
labelstringDisplay name shown in the UI
vehicleTypestring"car", "air", "sea", or "all"
typestring(optional) "depot" to make this an impound/depot garage
groupsstring|table(optional) Job name(s) required to access this garage
sharedboolean(optional) If true, all players with access see all vehicles
skipGarageCheckboolean(optional) If true, shows all owned vehicles regardless of which garage they are stored at
statestable(optional) Vehicle states to show (default: { GARAGED })
allowedIdentifierstable(optional) Array of citizen IDs with explicit access
spawnerVehiclestable(optional) Array of model names for spawner mode
spawnerVehicleConfigstable(optional) Per-model config for spawner (minJobGrade, livery, extras)
spawnerVehicleFolderstable(optional) Map of { [modelName] = folderId } for spawner folder assignment
showLiveriesExtrasMenuboolean(optional) Show livery/extras selector before spawning
accessPointstableArray of access point definitions (see below)

Access point definition:

{
    blip   = { name = 'Garage', sprite = 357, color = 44 },
    coords = vec4(x, y, z, heading),   -- interaction point
    spawn  = vec4(x, y, z, heading),   -- vehicle spawn point
    -- spawn can be a table of vec4 for multiple spawn candidates
}

Fires zephyr_garages:server:garageRegistered on the server and zephyr_garages:client:garageRegistered / garageUpdated on all clients.


SetGarageAllowedIdentifiers

Updates the allowed identifiers (citizen IDs) for a garage without re-registering it. Useful for job-assignment or instance-based access that changes at runtime.

local success = exports.zephyr_garages:SetGarageAllowedIdentifiers('private_hangar', {
    'ABC123',   -- citizenid of player 1
    'DEF456',   -- citizenid of player 2
})
ParameterTypeDescription
namestringGarage identifier key
identifierstableArray of citizen IDs that should have access. Pass an empty table to allow all.

Returns: booleantrue if the garage was found and updated, false if the garage does not exist.

Fires zephyr_garages:client:garageAccessUpdated on all clients.


SetVehicleGarage

Moves a vehicle record to a specific garage in the database, updating its state to GARAGED (or IMPOUNDED if the target is a depot). Use this to impound or relocate a vehicle from another resource.

local ok, err = exports.zephyr_garages:SetVehicleGarage(vehicleId, 'pillbox_impound')
if not ok then
    print('Failed: ' .. err.message)
end
ParameterTypeDescription
vehicleIdnumberDatabase ID of the vehicle (from qbx_vehicles)
garageNamestringTarget garage identifier key

Returns: true on success, or false, { code, message } on failure.

Error codes:

CodeDescription
"not_found"The target garage does not exist
"no_rows_changed"No database row was updated (vehicle ID not found)

Example — impound a vehicle from a police stop:

-- After seizing a vehicle, move it to the impound depot
local ok = exports.zephyr_garages:SetVehicleGarage(targetVehicleId, 'pillbox_impound')
if ok then
    TriggerClientEvent('ox_lib:notify', officerSrc, {
        type = 'success',
        description = 'Vehicle impounded.'
    })
end

SetVehicleDepotPrice

Sets the release fee for a vehicle in the depot/impound. The fee is paid by the owner when they retrieve the vehicle.

local ok, err = exports.zephyr_garages:SetVehicleDepotPrice(vehicleId, 5000)
ParameterTypeDescription
vehicleIdnumberDatabase ID of the vehicle
depotPricenumberRelease fee in dollars

Returns: true on success, or false, { code, message } on failure.

Example — set a custom impound fee when seizing a vehicle:

-- Calculate 5% of vehicle value as impound fee
local vehicleInfo = exports.qbx_core:GetVehiclesByName()[modelName]
local fee = math.floor((vehicleInfo and vehicleInfo.price or 0) * 0.05)
 
exports.zephyr_garages:SetVehicleGarage(vehicleId, 'pillbox_impound')
exports.zephyr_garages:SetVehicleDepotPrice(vehicleId, fee)