Exports
A list of available exports for integrating with cd_garage.
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).
--- @param vehicle number | entity 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.")local garageType = exports['cd_garage']:GetGarageType(vehicle)Get Vehicle Mileage
Retrieves the mileage for a vehicle mileage using the vehicle’s plate.
--- @param plate string The vehicle’s plate. Example: "ABCD1234"
--- @return number mileage The vehicle’s mileage.
--- @example
--- local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- local plate = exports['cd_garage']:GetPlate(vehicle)
--- local mileage = exports['cd_garage']:GetVehicleMileage(plate)
---
--- print("This vehicle has " .. mileage .. " miles on it.")local mileage = exports['cd_garage']:GetVehicleMileage(plate)Get Keys Data
Retrieves all stored key data for the player, including owned and temporary vehicle keys.
--- @return table keysData A table containing all key information for the player.
--- @example
--- local keysData = exports['cd_garage']:GetKeysData()
---
--- -- Example: Loop through all keys and print plate + model
--- for plate, data in pairs(keysData) do
--- print("Plate: " .. plate)
--- print("Vehicle: " .. data.vehicle)
--- print("Has Key: " .. tostring(data.has_key))
--- print("----------------------")
--- endlocal keysData = exports['cd_garage']:GetKeysData()Does Player Have Keys
Checks whether the player currently has keys for a specific vehicle based on its plate.
--- @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.")
--- endlocal hasKeys = exports['cd_garage']:DoesPlayerHaveKeys(plate)Get Plate
Returns the license plate text of the specified vehicle.
--- @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)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).
--- @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)local plate = exports['cd_garage']:GetCorrectPlateFormat(plate)Get Config
--- @return table config The full cd_garage config.lua.
--- @example
--- local config = exports['cd_garage']:GetConfig()
---
--- print(json.encode(config, { indent = true }))local config = exports['cd_garage']:GetConfig()Get Vehicles Data
Retrieves vehicle data such as name, category, price, model hash and spawn name for all vehicles the garage has cached.
--- @return table vehiclesData A table containing all vehicle data for all vehicles.
--- @example
--- local allVehiclesData = exports['cd_garage']:GetVehiclesData()
---
--- 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("----------------------")
--- endlocal allVehiclesData = exports['cd_garage']:GetVehiclesData()Server
Get Garage Limit
Returns the maximum number of vehicles a player can store in their garage.
--- @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 " .. limilocal limit = exports['cd_garage']:GetGarageLimit(source)Get Garage Count
Returns how many vehicles the player currently has stored in a specific garage type.
--- @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.")local count = exports['cd_garage']:GetGarageCount(source, garage_type )Get Config
Retrieves the full configuration table (config.lua) for cd_garage.
--- @return table config The full cd_garage configuration table.
--- @example
--- local config = exports['cd_garage']:GetConfig()
---
--- print(json.encode(config, { indent = true }))local config = exports['cd_garage']:GetConfig()Get Vehicles Data
Retrieves vehicle data such as name, category, price, model hash and spawn name for all vehicles the garage has cached.
--- @return table vehiclesData A table containing all vehicle data for all vehicles.
--- @example
--- local allVehiclesData = exports['cd_garage']:GetVehiclesData()
---
--- 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("----------------------")
--- endlocal allVehiclesData = exports['cd_garage']:GetVehiclesData()Is Vehicle Impounded
Checks whether a specified vehicle (by plate) is currently impounded.
--- @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']:IsVehicleImpounded(plate)
---
--- if isImpounded then
--- print("The vehicle with plate " .. plate .. " is currently impounded.")
--- else
--- print("The vehicle with plate " .. plate .. " is not impounded.")
--- endlocal isImpounded = exports['cd_garage']:IsVehicleImpounded(plate)Get Vehicle Impound Data
Retrieves impound information for a specific vehicle based on its plate.
--- @param plate string The vehicle’s license plate. Example: "ABCD1234"
--- @return table impoundData A table containing impound information such as impound ID, time, description, and retrieval status.
--- @example
--- local plate = "ABCD1234"
--- local impoundData = exports['cd_garage']:GetVehicleImpoundData(plate)
--- print(impoundData.plate)
--- print(impoundData.impound)
--- print(impoundData.props)
--- print(impoundData.mileage)
--- print(impoundData.label)
--- print(impoundData.description)
--- print(impoundData.canretrive)
--- print(impoundData.charname)
--- print(impoundData.charjob)
--- print(impoundData.price)
--- print(impoundData.impound_label)
--- print(impoundData.identifier)
--- print(impoundData.release_time)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).
--- @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)local correctPlate = exports['cd_garage']:GetCorrectPlateFormat(plate)Last updated
Was this helpful?

