legacy-garages
Integration
Exports and events for calling into legacy-garages from other resources, and the compatibility aliases available.
Integration
Every jg-advancedgarages:* export/event also exists under an equivalent legacy-garages: prefix. Third-party scripts hardcoded to jg-advancedgarages names keep working because the resource name is aliased via provide() — do not rename this resource in its fxmanifest, that will break those integrations.
Client exports
OpenGarage(garageId, isImpound)
Opens the garage UI for a garage id. If it is a spawner-type job garage and isImpound is falsy, it will try the showroom UI first.
Call from any client script:
-- client script
exports['legacy-garages']:OpenGarage('pdgarage', false)
StoreVehicle(garageId)
Stores the vehicle the player is in (or nearest within 5m) into the given garage.
-- client script
exports['legacy-garages']:StoreVehicle('pdgarage')
IsGarageUiOpen()
Returns whether a garage/showroom NUI is currently open.
-- client script
if exports['legacy-garages']:IsGarageUiOpen() then
-- avoid opening another UI
end
JG
Export table name for the jg-advancedgarages compat alias, set in config.
Server exports
IsVehicleInGarage(plate)
-- server script
local inGarage = exports['legacy-garages']:IsVehicleInGarage('ABC123')
GetVehicleGarage(plate)
-- server script
local garageId = exports['legacy-garages']:GetVehicleGarage('ABC123')
GetVehicle(plate)
-- server script
local row = exports['legacy-garages']:GetVehicle('ABC123')
ReturnVehicleToGarage(plate, garageId)
-- server script
exports['legacy-garages']:ReturnVehicleToGarage('ABC123', 'Legion Square')
ImpoundVehicle(plate, fee, reason, hours)
-- server script
exports['legacy-garages']:ImpoundVehicle('ABC123', 500, 'Illegal parking', 24)
SetVehicleOwner(plate, citizenid)
Used by dealership/handover scripts to set ownership directly.
-- server script
exports['legacy-garages']:SetVehicleOwner('ABC123', 'ABC12345')
Server callback exports (lib.callback)
These back the NUI but can be invoked by other server scripts too:
legacy-garages:getGarageData(src, garageId, isImpound)— fetch garage data for the NUI.legacy-garages:takeOut(src, plate, garageId)— take a vehicle out of a garage.legacy-garages:store(src, data)— store a vehicle.legacy-garages:rename(src, plate, nickname)— rename a vehicle.legacy-garages:financePayment(src, plate)— make one finance payment (requiresjg-dealerships).legacy-garages:financePayoff(src, plate)— pay off financing in full.legacy-garages:transferGarage(src, plate, toGarage)— move a vehicle to another public garage.legacy-garages:transferPlayer(src, plate, targetId)— transfer ownership to another player.legacy-garages:returnVehicle(src, plate, garageId)— tow a stray vehicle back into its garage.legacy-garages:releaseImpound(src, plate, garageId)— release an impounded vehicle.legacy-garages:impoundVehicle(src, data)— impound a vehicle (police form).legacy-garages:getSpawnerVehicles(src, garageId)— list a spawner job garage's fleet.legacy-garages:saveLoadout(src, garageId, model, config)— save a showroom loadout.legacy-garages:canSpawnSpawner(src, garageId, model)— validate + reserve a plate for a spawner vehicle.
Events to trigger (opening garages from other resources)
If your resource (e.g. a housing script) needs to open a garage it doesn't own the definition for:
-- server script
TriggerClientEvent('jg-advancedgarages:client:open-garage', targetSrc, 'property_42', 'car', vector4(1.0, 2.0, 3.0, 4.0))
-- or, using the first-party alias:
TriggerClientEvent('legacy-garages:client:open-garage', targetSrc, 'property_42', 'car', vector4(1.0, 2.0, 3.0, 4.0))
To trigger the store-vehicle flow:
-- server script
TriggerClientEvent('jg-advancedgarages:client:store-vehicle', targetSrc, 'property_42', 'car', vector4(1.0, 2.0, 3.0, 4.0))
To open the police impound form (e.g. from rcore_police):
-- server script
TriggerClientEvent('jg-advancedgarages:client:show-impound-form', targetSrc)
To despawn a vehicle by plate on whichever client has it streamed in:
-- server script
TriggerClientEvent('legacy-garages:client:despawn-plate', -1, 'ABC123')
To register a vehicle spawned outside a garage (e.g. valet features like lb-phone):
-- client script
TriggerServerEvent('jg-advancedgarages:server:register-vehicle-outside', plate, netId)
-- or:
TriggerServerEvent('legacy-garages:server:register-vehicle-outside', plate, netId)
To ask clients to refresh blips/TextUI after a job change:
-- server script
TriggerClientEvent('jg-advancedgarages:client:update-blips-text-uis', targetSrc)
Blip manager integration
If you run legacy-blipmanager, legacy-garages automatically listens for:
legacy-blipmanager:modeChanged(id, mode)— updates garage blip visibility mode ('all','closest','none') whenid == 'garages'.legacy-blipmanager:ready— triggers this resource to register its'garages'blip category.
No action needed from integrators beyond having legacy-blipmanager running; these are client-local events fired by that resource.