Skip to content

Exports

Note


These exports are entirely optional and can be used as needed within your own scripts or integrations.

Client

Get Garage Type

Returns the garage type of the specified vehicle (e.g., car, boat, air).

Parameters
lua
--- @param vehicle number The vehicle entity to check.
--- @return string garageType The garage type assigned to the vehicle.

--- @example
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local garageType = exports['cd_garage']:GetGarageType(vehicle)
print("This vehicle belongs to the " .. garageType .. " garage type.")
lua
local garageType = exports['cd_garage']:GetGarageType(vehicle)

Get Keys Data

Retrieves all stored key data for the player, including owned and temporary vehicle keys.

Parameters
lua
--- @return table keysData A table containing all key information for the player.

--- @example
-- Example: Loop through all keys and print plate + model
local keysData = exports['cd_garage']:GetKeysData()
for plate, data in pairs(keysData) do
     print("Plate: " .. plate)
     print("Vehicle: " .. data.vehicle)
     print("Has Key: " .. tostring(data.has_key))
     print("----------------------")
end
lua
local keysData = exports['cd_garage']:GetKeysData()

Does Player Have Keys

Checks whether the player currently has keys for a specific vehicle based on its plate.

Parameters
lua
--- @param plate string The vehicle's plate. Example: "ABCD1234"
--- @return boolean hasKeys Returns true if the player has keys for the specified vehicle.

--- @example
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local plate = exports['cd_garage']:GetPlate(vehicle)

local hasKeys = exports['cd_garage']:DoesPlayerHaveKeys(plate)
if hasKeys then
    print("Player has keys for this vehicle.")
else
    print("Player does not have keys for this vehicle.")
end
lua
local hasKeys = exports['cd_garage']:DoesPlayerHaveKeys(plate)

Get Plate

Returns the license plate text of the specified vehicle.

Parameters
lua
--- @param vehicle number | entity The vehicle entity to get the plate from.
--- @return string plate The vehicle's license plate text.

--- @example
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local plate = exports['cd_garage']:GetPlate(vehicle)

print("This vehicle's plate is: " .. plate)
lua
local plate = exports['cd_garage']:GetPlate(vehicle)

Get Correct Plate Format

Returns the vehicle's license plate text formatted according to the cd_garage config settings (supports trimmed, with_spaces, or mixed formats).

Parameters
lua
--- @param plate string The vehicle's original plate text.
--- @return string plate The formatted license plate text.

--- @example
local plate = "ABCD1234"
local correctPlate = exports['cd_garage']:GetCorrectPlateFormat(plate)

print("This vehicle's formatted plate is: " .. correctPlate)
lua
local plate = exports['cd_garage']:GetCorrectPlateFormat(plate)

Get Config

Parameters
lua
--- @return table config The full cd_garage config.lua.

--- @example
local config = exports['cd_garage']:GetConfig()
print(json.encode(config, { indent = true }))
lua
local config = exports['cd_garage']:GetConfig()

Get Vehicles Model Data

Retrieves vehicle model data such as name, category, price, model hash and spawn name for all vehicles the garage has cached.

Parameters
lua
--- @return table vehiclesData A table containing all vehicle data for all vehicles.

--- @example
local allVehiclesData = exports['cd_garage']:GetVehiclesModelData()
for modelHash, vehicle in pairs(allVehiclesData) do
     print("Model Hash: " .. modelHash)
     print("Name: " .. vehicle.name)
     print("Price: " .. vehicle.price)
     print("Category: " .. vehicle.category)
     print("Model: " .. vehicle.model)
     print("----------------------")
end
lua
local allVehiclesData = exports['cd_garage']:GetVehiclesModelData()

Server

Get Garage Limit

Returns the maximum number of vehicles a player can store in their garage.

Parameters
lua
--- @param source number The player's server ID.
--- @return number limit The maximum number of vehicles the player can store.

--- @example
local limit = exports['cd_garage']:GetGarageLimit(source)
print("This player can store up to " .. limi
lua
local limit = exports['cd_garage']:GetGarageLimit(source)

Get Garage Count

Returns how many vehicles the player currently has stored in a specific garage type.

Parameters
lua
--- @param source number The player's server ID.
--- @param garage_type string The garage type (e.g., "car", "boat", "air", "job").
--- @return number count The total number of vehicles stored in that garage type.

--- @example
local garage_type = "car"
local count = exports['cd_garage']:GetGarageCount(source, garage_type)

print("This player currently has " .. count .. " vehicles stored in the car garage.")
lua
local count = exports['cd_garage']:GetGarageCount(source, garage_type )

Get Config

Retrieves the full configuration table (config.lua) for cd_garage.

Parameters
lua
--- @return table config The full cd_garage configuration table.

--- @example
local config = exports['cd_garage']:GetConfig()
print(json.encode(config, { indent = true }))
lua
local config = exports['cd_garage']:GetConfig()

Get Vehicles Model Data

Retrieves vehicle model data such as name, category, price, model hash and spawn name for all vehicles the garage has cached.

Parameters
lua
--- @return table vehiclesData A table containing all vehicle data for all vehicles.

--- @example
local allVehiclesData = exports['cd_garage']:GetVehiclesModelData()
for modelHash, vehicle in pairs(allVehiclesData) do
     print("Model Hash: " .. modelHash)
     print("Name: " .. vehicle.name)
     print("Price: " .. vehicle.price)
     print("Category: " .. vehicle.category)
     print("Spawn Name: " .. vehicle.model)
     print("----------------------")
end
lua
local allVehiclesData = exports['cd_garage']:GetVehiclesModelData()

Is Vehicle In Impound

Checks whether a specified vehicle (by plate) is currently in the impound.

Parameters
lua
--- @param plate string The vehicle's license plate. Example: "ABCD1234"
--- @return boolean isImpounded Returns true if the vehicle is impounded, false otherwise.

--- @example
local plate = "ABCD1234"
local isImpounded = exports['cd_garage']:IsVehicleInImpound(plate)

if isImpounded then
     print("The vehicle with plate " .. plate .. " is currently impounded.")
else
     print("The vehicle with plate " .. plate .. " is not impounded.")
end
lua
local isImpounded = exports['cd_garage']:IsVehicleImpounded(plate)

Get Vehicle Impound Data

Retrieves impound information for a specific vehicle based on its plate.

Parameters
lua
--- @param plate string The vehicle's license plate. Example: "ABCD1234"
--- @return table|nil impoundData A table containing vehicle, impounder, impound, and owner information.

--- @example
local plate = "ABCD1234"
local impoundData = exports['cd_garage']:GetVehicleImpoundData(plate)

if impoundData then
    print('Vehicle Plate:', impoundData.vehicle.plate)
    print('Vehicle Props:', json.encode(impoundData.vehicle.props))
    print('Vehicle Label:', impoundData.vehicle.label)

    print('Impounder Job:', impoundData.impounder.job)
    print('Impounder Character Name:', impoundData.impounder.char_name)

    print('Impound ID:', impoundData.impound.id)
    print('Impound Label:', impoundData.impound.label)
    print('Impound Description:', impoundData.impound.description)
    print('Can Retrieve:', impoundData.impound.can_retrive)
    print('Impound Price:', impoundData.impound.price)
    print('Created At:', impoundData.impound.created_at)
    print('Release Time:', impoundData.impound.release_time)

    print('Owner Identifier:', impoundData.owner_identifier)
else
    print('No impound data found for plate:', plate)
end
lua
local impoundData = exports['cd_garage']:GetVehicleImpoundData(plate)

Get Correct Plate Format

Returns the vehicle's license plate text formatted according to the cd_garage config settings (supports trimmed, with_spaces, or mixed formats).

Parameters
lua
--- @param plate string The vehicle's original plate text.
--- @return string plate The formatted license plate text.

--- @example
local plate = "ABCD1234"
local correctPlate = exports['cd_garage']:GetCorrectPlateFormat(plate)

print("This vehicle's formatted plate is: " .. correctPlate)
lua
local correctPlate = exports['cd_garage']:GetCorrectPlateFormat(plate)

Hello!