Exports

Developer exports for integrating nc-garages with other resources.

Client Exports

openGarage

Open the garage UI for a specific garage. If no ID is provided, opens the nearest garage within 50m.

exports['nc-garages']:openGarage(garageId)
Parameter Type Required Description
garageId string Garage ID to open. nil = nearest garage

Example:

-- Open a specific garage
exports['nc-garages']:openGarage('legion_square')

-- Open nearest garage
exports['nc-garages']:openGarage()

closeGarage

Close the garage UI if it is currently open.

exports['nc-garages']:closeGarage()

isGarageOpen

Check if the garage UI is currently open.

local isOpen = exports['nc-garages']:isGarageOpen()

Returns: boolean


Server Exports

returnVehicleToGarage

Return a vehicle to garage by plate. Useful for external systems that need to force-return a vehicle (e.g., after a player disconnects with a vehicle out).

Does NOT affect impounded vehicles (state = 2).

local success = exports['nc-garages']:returnVehicleToGarage(plate)
Parameter Type Required Description
plate string Vehicle license plate

Returns: booleantrue if vehicle was returned, false if not found or already stored

Example:

-- Return a vehicle when player disconnects
AddEventHandler('playerDropped', function()
    local plate = GetSomeVehiclePlate() -- your logic
    if plate then
        exports['nc-garages']:returnVehicleToGarage(plate)
    end
end)

renameVehiclePlate

Update a vehicle's plate in the garage tracking system. Use this when another resource changes a vehicle's plate (e.g., a customs shop).

exports['nc-garages']:renameVehiclePlate(oldPlate, newPlate)
Parameter Type Required Description
oldPlate string Current plate
newPlate string New plate

Example:

-- After changing a plate at a customs shop
exports['nc-garages']:renameVehiclePlate('ABC 123', 'XYZ 789')
Last updated 1 month ago