Events
This page lists all cd_doorlock events, along with their purpose, parameters, and usage examples. All events are located in the [cd_doorlock/integrations] folder.
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
Defined with
RegisterNetEventin client files.Triggered using
TriggerEvent(if from client) orTriggerClientEvent(if from server).Run only on one player’s game client (the player’s PC).
Set Door State (Closest)
Sets the lock state of the closest door. The first argument state determines whether the door is locked (true) or unlocked (false).
---@param state boolean Determines the door state (true = locked, false = unlocked).
---@example
local state = trueTriggerEvent('cd_doorlock:SetDoorState_closest', state)TriggerClientEvent('cd_doorlock:SetDoorState_closest', source, state)Set Door State (By Name)
Sets the lock state of a specific door by name. The first argument state determines whether the door becomes locked (true) or unlocked (false). The second and third arguments specify the door’s name and location group.
---@param state boolean Determines the door state (true = locked, false = unlocked).
---@param doorName string The unique name of the door.
---@param locationGroup string The building’s location group.
---@example
local state = true
local doorName = 'Main Enterance'
local locationGroup = 'MRPD'TriggerEvent('cd_doorlock:SetDoorState_name', state, doorName, locationGroup)TriggerClientEvent('cd_doorlock:SetDoorState_name', source, state, doorName, locationGroup)Set Door State (By Unique ID)
Sets the lock state of a specific door using its unique ID. The first argument state determines whether the door becomes locked (true) or unlocked (false). The second argument is the door’s unique ID.
---@param state boolean Determines the door state (true = locked, false = unlocked).
---@param uniqueID string The unique ID assigned to the door.
---@example
local state = true
local uniqueID = "1234-5678"TriggerEvent('cd_doorlock:SetDoorState_uniqueid', state, uniqueID)TriggerClientEvent('cd_doorlock:SetDoorState_uniqueid', source, state, uniqueID)Server
Server-Side Events
Defined with
RegisterServerEventandAddEventHandlerin server files.Triggered using
TriggerEvent(if from server) orTriggerServerEvent(if from client).Run on the server, not on any individual player’s game client.
Lockdown Building
The first argument state sets the lockdown status (true = lock all doors, false = unlock all doors).
The second argument defines the location group of the building.
All players inside the defined building will receive a lockdown notification.
---@param state boolean Lockdown state (true = lock, false = unlock).
---@param locationGroup string The building’s location group.
---@example
local locationGroup = 'MRPD'
local state = trueTriggerServerEvent('cd_doorlock:LockdownBuilding', locationGroup , state)TriggerEvent('cd_doorlock:SetDoorState_uniqueid', locationGroup , state)Set Door Permissions (By Unique ID)
Sets the permission data for a specific door using its unique ID. You can set all permission types or only specific ones. When setting only certain permissions, leave the others nil, and they will simply not have any permissions assigned. The second argument perms is a table defining who can access the door.
---@param uniqueId string The door’s unique ID.
---@param perms table Permission settings for the door.
---@example
local uniqueId = 12
local perms = {
job = {
{name = 'police', grade = 0},
{name = 'ems', grade = 0}
},
identifier = { 'steam:11000010abcd123' },
ace = { 'admin' },
discord = { '123456789012345678' },
items = {
name = 'keycard',
amount = 1,
destroy = false
}
}
--- OR
local perms = {
job = {
{name = 'police', grade = 0},
{name = 'ems', grade = 0}
}
}TriggerServerEvent('cd_doorlock:SetDoorPerms', uniqueId, perms)TriggerEvent('cd_doorlock:SetDoorPerms', uniqueId, perms)Add Door Permissions (By Unique ID)
Adds new permission data to a specific door using its unique ID. The perms table is merged into the door's existing permissions instead of replacing them. You can add one or many permission types. Any permission type you leave nil will simply not be added.
---@param uniqueId string The door’s unique ID.
---@param perms table Permission data to add to the door.
---@example
local uniqueId = 12
local perms = {
identifier = { 'steam:11000010abcd123' },
items = {
name = 'keycard',
amount = 1,
destroy = false
}
}
--- OR
local perms = {
job = {
{name = 'police', grade = 0},
{name = 'ems', grade = 0}
}
}TriggerServerEvent('cd_doorlock:AddDoorPerms', uniqueId, perms)TriggerEvent('cd_doorlock:AddDoorPerms', uniqueId, perms)Last updated
Was this helpful?

