Documentation
The /doorlockcreator command, the keys, and the Doorlock Creator server exports — GetAllDoors, GetDoor, SetDoorState, EnsureDoors — plus the events for driving FiveM doors from heist and job scripts.
Key | Where | Does |
|---|---|---|
E | At a door | Locks or unlocks it (when |
0 – 9 · Backspace · Enter · Esc | Passcode keypad | Type, delete, confirm, close. |
Left click | Selecting door entities | Picks the outlined door. |
How another resource drives your doors — a heist that opens the vault when the drill finishes, a prison script that locks every cell at lockdown, a housing script that adds its front doors. All exports are server side.
Every door, sorted by id.
local doors = exports['qs-doorlock-creator']:GetAllDoors()
for _, door in ipairs(doors) do
print(door.id, door.name, door.locked, door.coords)
endField | Type | Meaning |
|---|---|---|
| number | The door's id, as in Edit door #id. |
| string | Its unique name. |
| vector3 | The centre — between both leaves on a double door. |
| number | The model of the (first) door. |
| boolean | Its current state. |
One door by id, in the same shape as GetAllDoors, or nil when it does not exist.
local door = exports['qs-doorlock-creator']:GetDoor(12)
if door and door.locked then
print(('%s is locked'):format(door.name))
endLocks (true) or unlocks (false) a door by force — no permission, distance, passcode or money check. The state is saved and sent to every player at once.
-- The drill finished: open the vault
local ok = exports['qs-doorlock-creator']:SetDoorState(12, false)
-- Lockdown: lock every door whose name starts with "cell_"
for _, door in ipairs(exports['qs-doorlock-creator']:GetAllDoors()) do
if door.name:find('^cell_') then
exports['qs-doorlock-creator']:SetDoorState(door.id, true)
end
endReturns true when the door is in the requested state (including when it already was), for an unknown id or a non-boolean state. It cancels a pending autolock and does not start one — lock the door again yourself when your event ends.
Makes sure a list of doors exists, creating the missing ones, and returns their ids in the same order. Safe to call on every start: a door that already exists is found again, not duplicated. Built for heist, robbery and housing scripts that bring their own doors.
local ids = exports['qs-doorlock-creator']:EnsureDoors({
{
name = 'fleeca_vault', -- optional; auto-named when omitted
model = 'v_ilev_gb_vauldr', -- model name, hash or numeric string (or modelHash = ...)
coords = vector3(254.12, 225.13, 101.87),
heading = 160.0, -- optional
locked = true, -- optional, defaults to locked
hidden = true, -- optional, no prompt: only scripts open it
},
{ modelHash = -1508355822, coords = { x = 1.0, y = 2.0, z = 3.0 } },
})
exports['qs-doorlock-creator']:SetDoorState(ids[1], false)Sent by the server to every client whenever a door changes, so your own client scripts can react — an alarm when the vault opens, a light that turns red on a locked cell.
Client event | Arguments | Fired when |
|---|---|---|
|
| Any lock or unlock: a player, an autolock or an export. |
|
| A door is created in the creator or by |
|
| A door is edited and saved. |
|
| A door is deleted. |
-- client
AddEventHandler('doorlock:doorStateChanged', function(id, state)
if id == 12 and state == 0 then
print('The vault is open')
end
end)The door table carries id, name, state, coords, maxDistance, needsPasscode, hidden, and the model and position of each leaf. The passcode itself is never sent.
A client script — a radial menu, a remote, a phone app — can ask to toggle a door exactly as pressing E does. Every normal check still applies: distance, permission, passcode, money and cooldown.
-- client: doorId, new state (1 lock · 0 unlock · nil toggle), passcode (optional)
TriggerServerEvent('doorlock:requestSetState', 12, nil)
TriggerServerEvent('doorlock:requestSetState', 14, 0, '4821')Each door's settings sit in the data column of qs_doorlocks as JSON. Reading it helps when auditing permissions in bulk or editing a value the creator does not show; restart the resource after editing it by hand.
{
"name": "mrpd_armory",
"distance": 2,
"isMultiDoor": false,
"doors": [
{ "model": 749848321, "coords": { "x": 453.08, "y": -982.57, "z": 30.83, "w": 90.0 } }
],
"requirements": {
"jobs": [ { "name": "police", "grades": [2, 3, 4] } ],
"players": [ { "identifier": "ABC12345", "name": "John Doe" } ],
"item": "door_keycard",
"money": 0,
"moneyType": "money",
"passcode": "1234"
},
"interactionAnim": { "enabled": true, "dict": "anim@heists@keycard@", "clip": "exit", "durationMs": 900 },
"doorUiSoundsEnabled": true,
"autolockSeconds": 10,
"doorRate": 10.0,
"hidden": false
}autolockSeconds, doorRate and hidden are optional and only set by hand or by EnsureDoors — see Usage.
falseField | Required | Accepts |
|---|---|---|
| Yes |
|
| Yes | A model name, a hash, or a hash as a string. |
| No | Without one the door is named |
| No |
|
An existing door is matched by its name (case-insensitive), then by its auto-name, then by the same model within 0.25 m — and returned as it is, never overwritten. A new door is a single door with a 2 m distance and no access rules; open it in the creator to add jobs, items or a passcode, and those changes survive every later call. An entry that cannot be created is skipped, so check the number of ids you get back.