Events

A list of available events to interact with cd_garage from your scripts.

Chat CommandsEventsExportsKeysItems

Note

These events are entirely optional and can be triggered as needed to integrate cd_garage with your own scripts or custom systems.


Client

Client-Side Events

Mileage

Sends a notification displaying the mileage of the vehicle you are in.

client-side to client-side
TriggerEvent('cd_garage:checkmileage')
server-side to client-side
TriggerClientEvent('cd_garage:checkmileage', source)


Impound Vehicle

Opens the impound UI. You can send a vehicle’s ID as the first argument; otherwise, it will automatically select the closest vehicle.

@parameters
---@param vehicle number | entity The vehicle entity to be impounded.
---@example
--- local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
client-side to client-side
TriggerEvent('cd_garage:ImpoundVehicle', vehicle)
server-side to client-side
TriggerClientEvent('cd_garage:ImpoundVehicle', source, vehicle)


Transfer Vehicle

Transfers the vehicle you are currently sitting in to another player.

@parameters
--- @param serverid number The server ID of the player to transfer the vehicle to.
--- @example
--- local serverid = 23
client-side to client-side
TriggerEvent('cd_garage:TransferVehicle', serverid)


Toggle Vehicle Lock

Toggles the lock state of the closest vehicle to the player.

client-side to client-side
TriggerEvent('cd_garage:ToggleVehicleLock')
server-side to client-side
TriggerClientEvent('cd_garage:ToggleVehicleLock', source)


Set Vehicle Locked

Locks a vehicle using the garage’s built-in key system. You must send the vehicle’s ID in the first argument.

@parameters
--- @param vehicle number | entity The vehicle entity to lock.
--- @example
--- local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
client-side to client-side
TriggerEvent('cd_garage:SetVehicleLocked', vehicle)
server-side to client-side
TriggerClientEvent('cd_garage:SetVehicleLocked', source, vehicle)


Set Vehicle Unlocked

Unlocks a vehicle using the garage’s built-in key system. You must send the vehicle’s ID in the first argument.

@parameters
--- @param vehicle number | entity The vehicle entity to unlock.
--- @example
--- local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
client-side to client-side
TriggerEvent('cd_garage:SetVehicleUnlocked', vehicle)
server-side to client-side
TriggerClientEvent('cd_garage:SetVehicleUnlocked', source, vehicle)


Update Garage Type

Updates the vehicle’s garage type in the database based on your current vehicle.

client-side to client-side
TriggerEvent('cd_garage:UpdateGarageType')
server-side to client-side
TriggerClientEvent('cd_garage:UpdateGarageType', source)


Impound Vehicle Directly

Impounds a vehicle directly using code without opening the impound UI. Sends detailed data such as the plate, impound location, vehicle properties, and retrieval status.

@parameters
--- @field plate string The vehicle’s plate.
--- @field impound number The Impound ID from Config.ImpoundLocations.
--- @field props table The vehicle’s properties.
--- @field time number The time the vehicle was impounded.
--- @field description string The reason or description for the impound.
--- @field canretrive boolean Whether the vehicle can be retrieved by the owner.
--- @field vehicle number | entity The vehicle entity.
client-side to client-side
TriggerEvent('cd_garage:ImpoundVehicle:Direct', {
    plate = plate,
    impound = impound,
    props = props,
    time = time,
    description = description,
    canretrive = canretrive,
    vehicle = vehicle,
})
server-side to client-side
TriggerClientEvent('cd_garage:ImpoundVehicle:Direct', source, {
    plate = plate,
    impound = impound,
    props = props,
    time = time,
    description = description,
    canretrive = canretrive,
    vehicle = vehicle,
})


Set Job Owned Vehicle

Marks the vehicle the player is currently sitting in as either a personal or society owned job vehicle. This event must be triggered while the player is inside the vehicle.

@parameters
--- @param type string The ownership type: 'personal' or 'society'.
--- @@example
--- local type = 'personal'
client-side to client-side
TriggerEvent('cd_garage:SetJobOwnedVehicle', type)
server-side to client-side
TriggerClientEvent('cd_garage:SetJobOwnedVehicle', source, type)

Open Property Garage

Opens the garage UI from a property script.

@parameters
--- @param type string The garage type: 'quick' or 'inside'.
--- @param shell string | nil The shell type: can be nil, '10cargarage_shell', or '40cargarage_shell'.
--- @example
--- local type = 'quick'
--- local shell = nil
client-side to client-side
TriggerEvent('cd_garage:PropertyGarage', 'quick', nil)
server-side to client-side
TriggerClientEvent('cd_garage:PropertyGarage', source, 'quick', nil)

Store Vehicle Property Garage

Stores the player's vehicle from a property script.

@parameters
--- The arguments below must remain exactly as shown (1, false, false) and cannot be changed.
client-side to client-side
TriggerEvent('cd_garage:StoreVehicle_Main', 1, false, false)
server-side to client-side
TriggerClientEvent('cd_garage:StoreVehicle_Main', source, 1, false, false)


Add Keys

Gives the player keys for a specific vehicle based on its plate.

@parameters
-- @param plate string The vehicle’s plate. Example: "ABCD1234"
--- @example
--- local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- local plate = exports['cd_garage']:GetPlate(vehicle)
client-side to client-side
TriggerEvent('cd_garage:AddKeys', plate)
server-side to client-side
TriggerClientEvent('cd_garage:AddKeys', source, plate)


Remove Keys

Removes the player's keys for a specific vehicle based on its plate.

@parameters
-- @param plate string The vehicle’s plate. Example: "ABCD1234"
--- @example
--- local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- local plate = exports['cd_garage']:GetPlate(vehicle)
client-side to client-side
TriggerEvent('cd_garage:RemoveKeys', plate)
server-side to client-side
TriggerClientEvent('cd_garage:RemoveKeys', source, plate)


Show Keys UI

Opens the vehicle keys UI for the player, displaying all vehicles they currently have keys for.

client-side to client-side
TriggerEvent('cd_garage:ShowKeys')
server-side to client-side
TriggerClientEvent('cd_garage:ShowKeys', source)


Server

Server-Side Events

Save Mileage Timer

Saves the mileage data for all vehicles currently tracked by cd_garage. Typically used before a server restart.

server-side to client-side
TriggerClientEvent('cd_garage:SaveAllMiles', -1)


Save Vehicle Damage Timer

Saves the damage data for all vehicles currently tracked by cd_garage. Typically used before a server restart.

server-side to client-side
TriggerClientEvent('cd_garage:SaveAllVehicleDamage', -1)


Save Impound Timer

Saves all active impound timers to the database, ensuring impounded vehicle durations are correctly updated and persistent.

server-side to server-side
TriggerEvent('cd_garage:SaveImpoundTimers')


Set Garage State

Updates the vehicle’s “in garage” status in the database.

--- @param plate string The vehicle’s license plate. Example: "ABCD1234"
--- @param state number The vehicle’s garage state. 0 = not in garage, 1 = in garage.
--- @example
--- local plate = "ABCD1234"
--- local state = 1
server-side to server-side
TriggerEvent('cd_garage:SetGarageState', plate, state)


Add Owned Keys

Used when adding an owned vehicle to a player’s garage. This ensures the new vehicle appears in the player’s keys UI.

@parameters
--- @param plate string The vehicle’s plate. Example: "ABCD1234"
--- @param model number The vehicle’s model hash. Example: 127317925
--- @example
--- local plate = "ABCD1234"
--- local model = GetEntityModel(GetVehiclePedIsIn(PlayerPedId()))
client-side to server-side
TriggerServerEvent('cd_garage:AddKeysOwnedVehicle', plate, model)
server-side to server-side
TriggerEvent('cd_garage:AddKeysOwnedVehicle', plate, model, src)


Add Persistent Vehicle

Used to mark a vehicle as persistent, allowing it to automatically save and respawn if it despawns while the server is running.

@parameters
--- @param plate string The vehicle’s plate. Example: "ABCD1234"
--- @param netId number The vehicle’s network ID. Example: NetworkGetNetworkIdFromEntity(vehicle)
--- @example
--- local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- local plate = exports['cd_garage']:GetPlate(vehicle)
--- local netId = NetworkGetNetworkIdFromEntity(vehicle)
client-side to server-side
TriggerServerEvent('cd_garage:AddPersistentVehicles', plate, netId)
server-side to server-side
TriggerEvent('cd_garage:AddPersistentVehicles', plate, netId)


Remove Persistent Vehicle

Used to remove a vehicle from the persistent system, preventing it from saving or respawning automatically.

@parameters
--- @param plate string The vehicle’s plate. Example: "ABCD1234"
--- @example
--- local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- local plate = exports['cd_garage']:GetPlate(vehicle)
client-side to server-side
TriggerServerEvent('cd_garage:RemovePersistentVehicles', plate)
server-side to server-side
TriggerEvent('cd_garage:RemovePersistentVehicles', plate)

Last updated

Was this helpful?