OrigenNetwork
Docs

Exports · origen_doorlock

All exports are registered under the resource name origen_doorlock and run server-side.


Server-side exports

toggleDoor(id, locked)

Locks or unlocks a door by its database ID. If locked is omitted, the door's current state is toggled.

lua
exports['origen_doorlock']:toggleDoor(id, locked)
ParameterTypeDescription
idnumberDoor ID from the origen_doorlock table
lockedboolean | niltrue = lock, false = unlock. Omit to toggle current state

Example — lock a door when a job clocks in:

lua
AddEventHandler('QBCore:Server:OnJobUpdate', function(source, job)
    if job.name == 'police' then
        exports['origen_doorlock']:toggleDoor(12, false) -- unlock door 12
    end
end)

getAllDoors()table

Returns the full in-memory doors table (Doors) with all loaded door data.

lua
local doors = exports['origen_doorlock']:getAllDoors()

Example — find a door by name:

lua
local doors = exports['origen_doorlock']:getAllDoors()
for id, door in pairs(doors) do
    if door.name == 'police_front' then
        exports['origen_doorlock']:toggleDoor(id, false)
        break
    end
end