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

-- Example output:
-- "This vehicle belongs to the car 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))
end

-- Example output:
-- Plate: ABCD1234
-- Vehicle: 67563675
-- Has Key: true
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)

-- Example output:
-- This vehicle's plate is: ABCD1234
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 = " ABC 12 "
local correctPlate = exports.cd_garage:GetCorrectPlateFormat(plate)

print("This vehicle's formatted plate is: " .. correctPlate)

-- Example output: 
-- This vehicle's formatted plate is: ACB 12
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 vehicleModelData = exports.cd_garage:GetVehiclesModelData()
for modelHash, modelData in pairs(vehicleModelData) do
	print("Name: " .. modelData.name)
	print("Model: " .. modelData.model)
	print("Model Hash: " .. modelHash)
	print("Price: " .. modelData.price)
	print("Category: " .. modelData.category)
end

print(json.encode(vehicleModelData, { indent = true }))
Example Output

Note

  • This table can include hundreds of vehicles.
  • The example below only shows how the data is structured.
lua
{
	[1922257928] = {
		name = "Sheriff Cruiser",
		model = "sheriff2",
		hash = 1922257928,
		price = 100000,
		category = "emergency",
   },
  	[1093792632] = {
		name = "Nero Custom",
		model = "nero2",
		hash = 1093792632,
		price = 260000,
		category = "super",
   },
}
lua
local vehicleModelData = exports.cd_garage:GetVehiclesModelData()

Get Garage Locations

Returns a table of all garage locations and their data.

Parameters
lua
--- @return table garageLocations A table containing all garage locations and their data.

--- @example
local garageLocations = exports.cd_garage:GetGarageLocations()
print(json.encode(garageLocations, { indent = true }))
Public Garage Example Output
lua
{
   ['5H74-KIY4-VS9W'] = {
		garage_id = "5H74-KIY4-VS9W",
		garage_label = "Legion Square",
		location_type = "public",
		shell = "10cargarage_shell",
		has_inside_garage = true,
		default = false,
		allowed_vehicle_types = {
			[1] = "car",
		},
      	coords = {
          	open = {
				x = 214.83,
				y = -805.37,
				z = 30.82,
				view_distance = 10,
				interact_distance = 5,
				ped_heading = 336.61,
         	},
        	spawn = {
				x = 211.65,
				y = -796.6,
				z = 29.29,
				heading = 343,
        	},
     	},
		blip = {
			enabled = true,
			sprite = 357,
			color = 4,
			scale = 1.0,
     	},
   	}
}
Impound Example Output
lua
{
	['L8P9-2V65-4HFW'] = {
		garage_id = "L8P9-2V65-4HFW",
		garage_label = "City Impound",
		location_type = "impound",
		has_inside_garage = false,
		default = false,
		allowed_vehicle_types = {
			[1] = "car",
		},
		coords = {
			open = {
				x = 401.28,
				y = -1631.44,
				z = 29.29,
				view_distance = 15,
				interact_distance = 5,
				ped_heading = 225.5,
			},
			spawn = {
				x = 404.66,
				y = -1642.03,
				z = 29.29,
				heading = 225.5,
			},
		},
		blip = {
			enabled = true,
			sprite = 289,
			color = 3,
			scale = 1.0,
		},
	},
}
Job Garage Example Output

Note

  • data.method can be "regular", "personal", or "society".
  • Only regular job garages use the data.vehicles table.
lua
{
   ['RF66-VNTO-A5HZ'] = {
		garage_id = "RF66-VNTO-A5HZ",
		garage_label = "BCSO",
		location_type = "job",
		has_inside_garage = false,
		default = false,
		allowed_vehicle_types = {
			[1] = "car",
		},
		coords = {
			open = {
				x = 1868.33,
				y = 3686.05,
				z = 33.78,
				view_distance = 15,
				interact_distance = 5,
				ped_heading = 211.34,
			},
			spawn = {
				x = 1872.68,
				y = 3687.19,
				z = 33.65,
				heading = 211.34,
			},
		},
		blip = {
			enabled = true,
			sprite = 357,
			color = 4,
			scale = 0.6,			
		},
		data = {
			method = "regular",
			jobs = {
				[1] = "police",
			},
			vehicles = {
				[1] = {
				plate = "PD",
				job = "police",
				job_grade = 0,
				model = 2046537925,
				custom_label = "Police Cruiser",
				spawn_max = true,
				livery = {
					method = "livery",
					value = 0,
				},
				props = {
					model = 2046537925,
					plate = "PD",
					engineHealth = 1000.0,
					bodyHealth = 1000.0,
					fuelTankHealth = 1000.0,
					fuelLevel = 100.0,
				},
				},
				[2] = {
				plate = "PD2",
				job = "police",
				job_grade = 0,
				model = -1627000575,
				custom_label = "Police Buffalo",
				spawn_max = true,
				livery = {
					method = "livery",
					value = 3,
				},
				props = {
					plate = "PD2",
					model = -1627000575,
					engineHealth = 1000.0,
					bodyHealth = 1000.0,
					fuelTankHealth = 1000.0,
					fuelLevel = 100.0,
				},
				},
			},
		},
	},
}
Gang Garage Example Output
lua
{
	['ZTLC-HUJG-OTVL'] = {
		garage_id = "ZTLC-HUJG-OTVL",
		garage_label = "Ballas",
		location_type = "gang",
		has_inside_garage = false,
		default = false,
		allowed_vehicle_types = {
			[1] = "car",
		},
		coords = {
			open = {
				x = 102.48,
				y = -1955.1,
				z = 20.73,
				view_distance = 10,
				interact_distance = 5,
			},
			spawn = {
				x = 104.51,
				z = 20.27,
				y = -1954.2,
				heading = 336.53,
			},
		},
		blip = {
			enabled = true,
			sprite = 84,
			color = 22,
			scale = 0.6,
		},
		data = {gang_garage = "ballas"},
	},
}
Private Garage Example Output
lua
{
	['9QAP-GZN9-U007'] = {
		garage_id = "9QAP-GZN9-U007",
		garage_label = "Gee Private Garage",
		location_type = "private",
		has_inside_garage = false,
		default = false,
		allowed_vehicle_types = {
			[1] = "car",
		},
		coords = {
			open = {
				x = 113.64,
				y = -1600.24,
				z = 29.53,
				view_distance = 10,
				interact_distance = 2,
				ped_heading = 0,
			},
			spawn = {
				x = 113.64,
				y = -1600.24,
				z = 29.53,
				heading = 17.47,
			},
		},
		blip = {
			enabled = true,
			sprite = 357,
			color = 4,
			scale = 0.5,
		},
		data = {
			owner_identifier = "QFE19818",
			access_identifiers = {
				[1] = "GQZ91611",
			},
		},
	},
}
Property Garage Example Output
lua
{
	['9QAP-GZN9-U007'] = {
		garage_id = "9QAP-GZN9-U007",
		garage_label = "Ramp Property Garage",
		location_type = "property",
		has_inside_garage = false,
		default = false,
		allowed_vehicle_types = {
			[1] = "car",
		},
		coords = {
			open = {
				x = 113.64,
				y = -1600.24,
				z = 29.53,
				view_distance = 10,
				interact_distance = 2,
				ped_heading = 0,
			},
			spawn = {
				x = 113.64,
				y = -1600.24,
				z = 29.53,
				heading = 17.47,
			},
		},
		blip = {
			enabled = true,
			sprite = 357,
			color = 4,
			scale = 0.5,
		},
		data = {
			owner_identifier = "QFE19818",
			access_identifiers = {
				[1] = "GQZ91611",
			},
		},
	},
}
lua
local garageLocations = exports.cd_garage:GetGarageLocations()

Get Garage Label From Garage ID

Returns the garage label from a garage ID.

Parameters
lua
--- @param garageId string The garage ID.
--- @return string garageLabel The garage label.

--- @example
local garageId = '0ZDV-42KH-8OSX'
local garageLabel = exports.cd_garage:GetGarageLabelFromGarageId(garageId)

print(garageLabel)

-- Example output: 
-- Legion Garage
lua
local garageLabel = exports.cd_garage:GetGarageLabelFromGarageId(garageId)

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 " .. limit .. " vehicles in their garage".)

-- Example Output:
-- This player can store up to 10 vehicles in their garage.
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 their garage.")

-- Example Output:
-- This player currently has 8 vehicles stored in their 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 vehicleModelData = exports.cd_garage:GetVehiclesModelData()
for modelHash, modelData in pairs(vehicleModelData) do
	print("Name: " .. modelData.name)
	print("Model: " .. modelData.model)
	print("Model Hash: " .. modelHash)
	print("Price: " .. modelData.price)
	print("Category: " .. modelData.category)
end

print(json.encode(vehicleModelData, { indent = true }))
Example Output

Note

  • This table can include hundreds of vehicles.
  • The example below only shows how the data is structured.
lua
{
	[1922257928] = {
		name = "Sheriff Cruiser",
		model = "sheriff2",
		hash = 1922257928,
		price = 100000,
		category = "emergency",
   },
  	[1093792632] = {
		name = "Nero Custom",
		model = "nero2",
		hash = 1093792632,
		price = 260000,
		category = "super",
   },
}
lua
local vehicleModelData = 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

-- Example Output: 
-- The vehicle with plate ABCD1234 is currently impounded.
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('Owner Identifier:', impoundData.owner_identifier)

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

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

    print('Impound ID:', impoundData.impound.id)
    print('Impound Label:', impoundData.impound.label)
    print('Impound Description:', impoundData.impound.description)
	print('Impound Price:', impoundData.impound.price)
    print('Can Retrieve:', impoundData.impound.can_retrive)
    print('Created At:', impoundData.impound.created_at)
    print('Release Time:', impoundData.impound.release_time)
else
    print('No impound data found for plate:', plate)
end
Example Output
lua
{
	owner_identifier = "QFE19818",
	impounder = {
		job = "police",
		char_name = "Ramp Walker",
	},
	vehicle = {
		plate = "64LVL447",
		label = "Adder",
		props = {} -- Standard vehicle properties have been removed to keep this example short.
	},
	impound = {
		id = "L8P9-2V65-4HFW",
		label = "City Impound",
		description = "Suspected of supporting trump",
		price = 2800,
		can_retrive = true,
		created_at = 1785940425000,
		release_time = 1786113120000,
	},
}
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 = " ABC 12 "
local correctPlate = exports.cd_garage:GetCorrectPlateFormat(plate)

print("This vehicle's formatted plate is: " .. correctPlate)

-- Example output: 
-- This vehicle's formatted plate is: ACB 12
lua
local correctPlate = exports.cd_garage:GetCorrectPlateFormat(plate)

Get Garage Locations

Returns a table of all garage locations and their data.

Parameters
lua
--- @return table garageLocations A table containing all garage locations and their data.

--- @example
local garageLocations = exports.cd_garage:GetGarageLocations()
print(json.encode(garageLocations, { indent = true }))
Public Garage Example Output
lua
{
   ['5H74-KIY4-VS9W'] = {
		garage_id = "5H74-KIY4-VS9W",
		garage_label = "Legion Square",
		location_type = "public",
		shell = "10cargarage_shell",
		has_inside_garage = true,
		default = false,
		allowed_vehicle_types = {
			[1] = "car",
		},
      	coords = {
          	open = {
				x = 214.83,
				y = -805.37,
				z = 30.82,
				view_distance = 10,
				interact_distance = 5,
				ped_heading = 336.61,
         	},
        	spawn = {
				x = 211.65,
				y = -796.6,
				z = 29.29,
				heading = 343,
        	},
     	},
		blip = {
			enabled = true,
			sprite = 357,
			color = 4,
			scale = 1.0,
     	},
   	}
}
Impound Example Output
lua
{
	['L8P9-2V65-4HFW'] = {
		garage_id = "L8P9-2V65-4HFW",
		garage_label = "City Impound",
		location_type = "impound",
		has_inside_garage = false,
		default = false,
		allowed_vehicle_types = {
			[1] = "car",
		},
		coords = {
			open = {
				x = 401.28,
				y = -1631.44,
				z = 29.29,
				view_distance = 15,
				interact_distance = 5,
				ped_heading = 225.5,
			},
			spawn = {
				x = 404.66,
				y = -1642.03,
				z = 29.29,
				heading = 225.5,
			},
		},
		blip = {
			enabled = true,
			sprite = 289,
			color = 3,
			scale = 1.0,
		},
	},
}
Job Garage Example Output

Note

  • data.method can be "regular", "personal", or "society".
  • Only regular job garages use the data.vehicles table.
lua
{
   ['RF66-VNTO-A5HZ'] = {
		garage_id = "RF66-VNTO-A5HZ",
		garage_label = "BCSO",
		location_type = "job",
		has_inside_garage = false,
		default = false,
		allowed_vehicle_types = {
			[1] = "car",
		},
		coords = {
			open = {
				x = 1868.33,
				y = 3686.05,
				z = 33.78,
				view_distance = 15,
				interact_distance = 5,
				ped_heading = 211.34,
			},
			spawn = {
				x = 1872.68,
				y = 3687.19,
				z = 33.65,
				heading = 211.34,
			},
		},
		blip = {
			enabled = true,
			sprite = 357,
			color = 4,
			scale = 0.6,			
		},
		data = {
			method = "regular",
			jobs = {
				[1] = "police",
			},
			vehicles = {
				[1] = {
				plate = "PD",
				job = "police",
				job_grade = 0,
				model = 2046537925,
				custom_label = "Police Cruiser",
				spawn_max = true,
				livery = {
					method = "livery",
					value = 0,
				},
				props = {
					model = 2046537925,
					plate = "PD",
					engineHealth = 1000.0,
					bodyHealth = 1000.0,
					fuelTankHealth = 1000.0,
					fuelLevel = 100.0,
				},
				},
				[2] = {
				plate = "PD2",
				job = "police",
				job_grade = 0,
				model = -1627000575,
				custom_label = "Police Buffalo",
				spawn_max = true,
				livery = {
					method = "livery",
					value = 3,
				},
				props = {
					plate = "PD2",
					model = -1627000575,
					engineHealth = 1000.0,
					bodyHealth = 1000.0,
					fuelTankHealth = 1000.0,
					fuelLevel = 100.0,
				},
				},
			},
		},
	},
}
Gang Garage Example Output
lua
{
	['ZTLC-HUJG-OTVL'] = {
		garage_id = "ZTLC-HUJG-OTVL",
		garage_label = "Ballas",
		location_type = "gang",
		has_inside_garage = false,
		default = false,
		allowed_vehicle_types = {
			[1] = "car",
		},
		coords = {
			open = {
				x = 102.48,
				y = -1955.1,
				z = 20.73,
				view_distance = 10,
				interact_distance = 5,
			},
			spawn = {
				x = 104.51,
				z = 20.27,
				y = -1954.2,
				heading = 336.53,
			},
		},
		blip = {
			enabled = true,
			sprite = 84,
			color = 22,
			scale = 0.6,
		},
		data = {gang_garage = "ballas"},
	},
}
Private Garage Example Output
lua
{
	['9QAP-GZN9-U007'] = {
		garage_id = "9QAP-GZN9-U007",
		garage_label = "Gee Private Garage",
		location_type = "private",
		has_inside_garage = false,
		default = false,
		allowed_vehicle_types = {
			[1] = "car",
		},
		coords = {
			open = {
				x = 113.64,
				y = -1600.24,
				z = 29.53,
				view_distance = 10,
				interact_distance = 2,
				ped_heading = 0,
			},
			spawn = {
				x = 113.64,
				y = -1600.24,
				z = 29.53,
				heading = 17.47,
			},
		},
		blip = {
			enabled = true,
			sprite = 357,
			color = 4,
			scale = 0.5,
		},
		data = {
			owner_identifier = "QFE19818",
			access_identifiers = {
				[1] = "GQZ91611",
			},
		},
	},
}
Property Garage Example Output
lua
{
	['9QAP-GZN9-U007'] = {
		garage_id = "9QAP-GZN9-U007",
		garage_label = "Ramp Property Garage",
		location_type = "property",
		has_inside_garage = false,
		default = false,
		allowed_vehicle_types = {
			[1] = "car",
		},
		coords = {
			open = {
				x = 113.64,
				y = -1600.24,
				z = 29.53,
				view_distance = 10,
				interact_distance = 2,
				ped_heading = 0,
			},
			spawn = {
				x = 113.64,
				y = -1600.24,
				z = 29.53,
				heading = 17.47,
			},
		},
		blip = {
			enabled = true,
			sprite = 357,
			color = 4,
			scale = 0.5,
		},
		data = {
			owner_identifier = "QFE19818",
			access_identifiers = {
				[1] = "GQZ91611",
			},
		},
	},
}
lua
local garageLocations = exports.cd_garage:GetGarageLocations()

Get Garage Label From Garage ID

Returns the garage label from a garage ID.

Parameters
lua
--- @param garageId string The garage ID.
--- @return string garageLabel The garage label.

--- @example
local garageId = '0ZDV-42KH-8OSX'
local garageLabel = exports.cd_garage:GetGarageLabelFromGarageId(garageId)

print(garageLabel)

-- Example output: 
-- Legion Garage
lua
local garageLabel = exports.cd_garage:GetGarageLabelFromGarageId(garageId)

Hello!