# Exports

{% content-ref url="chat-commands" %}
[chat-commands](https://docs.codesign.pro/paid-scripts/garage/developer-api/chat-commands)
{% endcontent-ref %}

{% content-ref url="events" %}
[events](https://docs.codesign.pro/paid-scripts/garage/developer-api/events)
{% endcontent-ref %}

{% content-ref url="exports" %}
[exports](https://docs.codesign.pro/paid-scripts/garage/developer-api/exports)
{% endcontent-ref %}

{% content-ref url="keys" %}
[keys](https://docs.codesign.pro/paid-scripts/garage/developer-api/keys)
{% endcontent-ref %}

{% content-ref url="items" %}
[items](https://docs.codesign.pro/paid-scripts/garage/developer-api/items)
{% endcontent-ref %}

***

{% hint style="info" %}

#### **Note**

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

***

## Client

### **Get Garage Type**

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

{% code title="@parameters" %}

```lua
--- @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.")
```

{% endcode %}

```lua
local garageType = exports['cd_garage']:GetGarageType(vehicle)
```

***

### **Get Vehicle Mileage**

Retrieves the mileage for a vehicle mileage using the vehicle’s plate.

{% code title="@parameters" %}

```lua
--- @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.")
```

{% endcode %}

```lua
local mileage = exports['cd_garage']:GetVehicleMileage(plate)
```

***

### **Get Keys Data**

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

{% code title="@parameters" %}

```lua
--- @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("----------------------")
--- end
```

{% endcode %}

```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.

{% code title="@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
```

{% endcode %}

```lua
local hasKeys = exports['cd_garage']:DoesPlayerHaveKeys(plate)
```

***

### **Get Plate**

Returns the license plate text of the specified vehicle.

{% code title="@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)
```

{% endcode %}

```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).

{% code title="@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)
```

{% endcode %}

```lua
local plate = exports['cd_garage']:GetCorrectPlateFormat(plate)
```

***

### **Get Config**

{% code title="@parameters" %}

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

{% endcode %}

```lua
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.

{% code title="@parameters" %}

```lua
--- @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("----------------------")
--- end
```

{% endcode %}

```lua
local allVehiclesData = exports['cd_garage']:GetVehiclesData()
```

##

## Server

### **Get Garage Limit**

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

{% code title="@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
```

{% endcode %}

```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.

{% code title="@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.")
```

{% endcode %}

```lua
local count = exports['cd_garage']:GetGarageCount(source, garage_type )
```

***

***

### **Get Config**

Retrieves the full configuration table (config.lua) for cd\_garage.

```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 Data**

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

```lua
--- @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("----------------------")
--- end
```

```lua
local allVehiclesData = exports['cd_garage']:GetVehiclesData()
```

***

### **Is Vehicle Impounded**

Checks whether a specified vehicle (by plate) is currently impounded.

{% code title="@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']:IsVehicleImpounded(plate)
---
--- if isImpounded then
---     print("The vehicle with plate " .. plate .. " is currently impounded.")
--- else
---     print("The vehicle with plate " .. plate .. " is not impounded.")
--- end
```

{% endcode %}

```lua
local isImpounded = exports['cd_garage']:IsVehicleImpounded(plate)
```

***

### **Get Vehicle Impound Data**

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

{% code title="@parameters" %}

```lua
--- @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)
```

{% endcode %}

```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).

{% code title="@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)
```

{% endcode %}

```lua
local correctPlate = exports['cd_garage']:GetCorrectPlateFormat(plate)
```
