OPX//77
CreatorsServer exports

SetDoorState

Last updated on

Locks or unlocks a door, ox_doorlock's setDoorState.

local res = exports.opx_infinity:SetDoorState(ref, state)

Scope write · must be awaited — a synchronous call answers export.mustAwait before touching anything.

Parameters

  • ref: integer | string — door id or seeded key

  • state: 0 | 1 | boolean — 1 or true locks

  • Your resource decided: the door's groups, items and code are not checked. The change reaches everyone in the bucket, re-arms the autolock and raises opx:on:doorlock:changed with by = 'ext:<your resource>'.

Returns

  • the state set

Errors

  • doorlock.unknownDoor, doorlock.badState, export.badArgument, error.unavailable
Example
CreateThread(function()
  local pending, why = Open77.exports.call('opx_infinity', 'SetDoorState', 12, 0)
  if not pending then return print('not sent: ' .. tostring(why)) end
  local res = pending:await()
  if not (res and res.ok) then return print('refused: ' .. tostring(res and res.error)) end
  print('door unlocked')
end)

On this page

No Headings