Skip to main content

Exports

Exports documented currently for Wasabi Garage Creator (wasabi_garage).


Server exports are trusted: they do not check the permissions of a calling player, so only call them from your own server code.

Client Exports​


Garages​

OpenGarage

Open a garage's showroom from your own script, for example a job garage. The player does not need to stand at the menu point, but the garage's job access still applies.

exports['wasabi_garage']:OpenGarage(data)
ParameterTypeRequiredDescription
data.idnumber|stringYesGarage id, or the Script key set in the creator (for example 'police').
data.coordsvector4NoSpawn the taken-out car here instead of at the garage's spawn points. Must be within 60 m of where the menu was opened.
exports['wasabi_garage']:OpenGarage({ id = 'police', coords = vector4(441.0, -1013.0, 28.6, 90.0) })
IsShowroomOpen
local open = exports['wasabi_garage']:IsShowroomOpen()

Returns: boolean — true while the showroom menu is open.

GetGarages

Every garage synced to this client.

local garages = exports['wasabi_garage']:GetGarages()

Returns: table[] — { id, label, type, access, menu, spawns, zone, interior, storageFee, price, jobs, flags } per garage. type is 'car', 'boat' or 'air'; access is 'public', 'private' or 'impound'.

StoreCurrentVehicle

Park the vehicle the player is driving in the garage whose parking zone (or spawn point) it is in. Same checks and fees as the park prompt.

local started = exports['wasabi_garage']:StoreCurrentVehicle()

Returns: boolean — false when the player is not in a vehicle or not at a garage they can park in. The result of the park itself is shown as a notification.

Walk-in interiors​

EnterGarageInterior

Walk into a garage's interior. The player must be within 10 m of the garage's menu point and on foot.

exports['wasabi_garage']:EnterGarageInterior(garageId)
ParameterTypeRequiredDescription
garageIdnumberYesGarage id.
LeaveGarageInterior

Leave the current interior on foot, back to the garage door.

exports['wasabi_garage']:LeaveGarageInterior()
DriveOutOfInterior

Drive the vehicle the player sits in out of the interior, like pressing E.

exports['wasabi_garage']:DriveOutOfInterior()
IsInGarageInterior
local inside = exports['wasabi_garage']:IsInGarageInterior()

Returns: boolean

GetInteriorCars
local cars = exports['wasabi_garage']:GetInteriorCars()

Returns: table|nil — cars in the current interior keyed by network id ({ plate, hash, tag, tagColor, fuel, engine, body, mileage, ownerName?, display? }), or nil when not inside. display = true marks a locked car the player cannot drive.

Impound​

OpenImpoundForm

Open the officer impound form for a vehicle. Players outside impound.jobs get an error from the server.

exports['wasabi_garage']:OpenImpoundForm(vehicle?)
ParameterTypeRequiredDescription
vehiclenumberNoVehicle entity. Defaults to the closest vehicle within 5 m.

Server Exports​


Garages​

GetGarage
local garage = exports['wasabi_garage']:GetGarage(id)
ParameterTypeRequiredDescription
idnumberYesGarage id.

Returns: table|nil — { id, label, type, access, coords = { menuCoords, spawnCoords } }. menuCoords and spawnCoords (the first spawn point) are vector3.

GetGarages
local garages = exports['wasabi_garage']:GetGarages()

Returns: table[] — every garage, in the same shape as GetGarage.

GetImpoundLots
local lots = exports['wasabi_garage']:GetImpoundLots()

Returns: table[] — impound lots only, in the same shape as GetGarage.

Vehicles​

GiveVehicle

Give a vehicle to an online player, stored in a garage. Same as /givecar.

local plate, garageId = exports['wasabi_garage']:GiveVehicle(target, model, plate?, garageId?)
ParameterTypeRequiredDescription
targetnumberYesServer id of the new owner.
modelstringYesVehicle spawn name.
platestringNoPlate (upper-cased). A random free plate is generated when omitted.
garageIdnumberNoGarage to store it in. Defaults to the first public car garage.

Returns: string, number? — the plate and garage id, or nil and a reason (no_player, plate_taken, db_error).

warning

Pass garageId for boats and aircraft. Without it, the vehicle is stored in the first public car garage, where boats and aircraft are not listed.

RepairVehicle

Repair a garage vehicle and clear its saved damage. Same as /garagerepair.

local ok = exports['wasabi_garage']:RepairVehicle(plate)
ParameterTypeRequiredDescription
platestringYesPlate.

Returns: boolean — false when the plate is not an owned vehicle.

Impound​

ImpoundVehicle

Impound a vehicle by plate. Also available as impound. The live vehicle is removed and the owner is notified.

local ok, result = exports['wasabi_garage']:ImpoundVehicle(plate, opts?)
ParameterTypeRequiredDescription
platestringYesPlate.
opts.lotIdnumberNoImpound lot id. Defaults to the first impound lot.
opts.minutesnumberNoHold time (0 to impound.maxMinutes). Default 0.
opts.feenumberNoRelease fine (0 to impound.maxFee). Default 0.
opts.payToReleasebooleanNofalse: the owner must wait out the hold time before paying. Default true.
opts.notestringNoNote shown on the ticket (up to 255 characters).
opts.reasonstringNo'police' (default), 'destroyed', 'lost', 'restart', 'sold' or 'admin'.
opts.officernumberNoServer id of the officer, shown on the ticket.
opts.entitynumberNoThe vehicle entity, if you already have it.
opts.forcebooleanNoImpound even when a player is inside.

Returns: boolean, number|string — true and the impound record id, true, 'unowned' when the plate is not an owned vehicle (the entity is just deleted), or false and a reason (bad_request, occupied, no_lot, busy, db_error).

Housing​

Use these from your housing script to give each property its own private garage. Character ids are the framework character identifier (citizenid on Qbox and QBCore, identifier on ESX, charId on OX).

CreateHouseGarage
local garageId = exports['wasabi_garage']:CreateHouseGarage(data)
ParameterTypeRequiredDescription
data.menuvector4YesMenu point.
data.labelstringNoDefault 'House Garage'.
data.typestringNo'car' (default), 'boat' or 'air'.
data.spawnsvector4[]NoSpawn points. Defaults to the menu point.
data.interiorstringNoInterior preset key ('garage_2', 'garage_6', 'garage_10').
data.ownerstring|numberNoOwner character id.
data.houseIdanyNoYour property id, stored with the garage.
data.hideBlipbooleanNoHide the blip.

Returns: number|nil — the new garage id.

SetGarageOwner

Set (or clear) the owner of a private garage. Cars of players who lose access are moved out (see private.guestFallback).

local ok = exports['wasabi_garage']:SetGarageOwner(garageId, charId?)

Returns: boolean

SetGarageKeyHolders

Replace the key holder list of a garage.

local ok = exports['wasabi_garage']:SetGarageKeyHolders(garageId, { charId1, charId2 })

Returns: boolean

AddGarageKey
local ok = exports['wasabi_garage']:AddGarageKey(garageId, charId)

Returns: boolean

RemoveGarageKey

Removes the key and moves that player's cars out of the garage.

local removed = exports['wasabi_garage']:RemoveGarageKey(garageId, charId)

Returns: boolean — true if the key existed.

RemoveHouseGarage

Delete a house garage. The owner's cars parked there go to the impound lot (free to release), key holders' cars follow private.guestFallback, and its furniture and keys are removed.

local ok = exports['wasabi_garage']:RemoveHouseGarage(garageId)

Returns: boolean