CreatorsServer exports
CreateDoor
Last updated on
Creates a managed door, ox_doorlock's createDoor.
local res = exports.opx_infinity:CreateDoor(data)Scope write · must be awaited — a synchronous call answers export.mustAwait before touching anything.
Parameters
-
data:
table— a door in ox's shape, as on doorlocknative(one leaf,0x+ 16 hex digits) ordoors(two{ native, coords })coords:{ x, y, z }— defaults to the middle of a double doorname?,bucket?,state?,groups?,items?,characters?,passcode?,autolock?,maxDistance?,lockpick?,lockpickDifficulty?,auto?,hideUi?,holdOpen?,onDuty?,lockSound?,unlockSound?
-
Validated like a staff save (groups and items must exist, a leaf belongs to one door only), without the staff position check. Audited with
ext:<your resource>.
Returns
- the new door id
Errors
doorlock.error.<code>:bad_doorand the other malformed-field codes (bad_position,bad_groups… see refusal codes),unknown_group,unknown_item,door_taken,too_many_doors,not_loaded,save_failedexport.badArgument,error.unavailable- Before PR #95 these were spelled
doorlock.<code>. See Upgrading.
CreateThread(function()
local pending = Open77.exports.call('opx_infinity', 'CreateDoor', {
name = 'Safehouse', native = '0x00000000ABCDEF01',
coords = { x = 10.0, y = 20.0, z = 3.0 },
items = { { name = 'door_key', metadata = 'safehouse' } },
})
local res = pending and pending:await()
if res and res.ok then print('door #' .. res.value) else print(res and res.error) end
end)