OPX//77
opx_infinitydoorlock

Client

Last updated on

The doorlock contract on the client — the nearest door, turning it, picking it, and the staff panel.

local doorlock = OPX.Api.Get('doorlock')

From client code inside opx_infinity. Nothing here decides: Use and PickClosest only ask, and the server's answer arrives as a toast (and on opx:net:doorlock:answer).

State

What this client knows.

doorlock.State()

Returns

  • Result — { doors, bucket, mode, nearest?, shown, staff?, picking?, applied, key? }
    • doors: number — count in this bucket
    • mode: 'networked' | 'local'
    • nearest: integer? — id of the door in reach
    • staff: table? — { save, remove, lock, key, bypass, teleport }, nil for a player
    • applied: table — native id to state this client set (local backend)

Nearest

ox's getClosestDoor: the door the player stands at.

doorlock.Nearest()

Returns

  • Result — { id, name, state }; error doorlock.noDoor

IdOf

ox's getDoorIdFromEntity, on a native door id.

doorlock.IdOf(native)

Parameters

  • native: string — 0x + 16 hex digits

Returns

  • Result — the door id; error doorlock.noDoor

Use

ox's useClosestDoor: asks to flip the door the player stands at.

doorlock.Use(origin)

Parameters

  • origin?: string — default 'contract'

Returns

  • Result — true once sent; error doorlock.noDoor
Example
local sent = doorlock.Use('mymodule')
if not sent.ok then print('no door here') end

PickClosest

ox's pickClosestDoor: starts a lockpick on the door in reach.

doorlock.PickClosest()

Returns

  • Result — true once sent; error doorlock.noDoor

OpenStaff

Opens the staff panel. The server still checks every write.

doorlock.OpenStaff()

Returns

  • Result — error doorlock.notStaff for a player without command.opx.doorlock

On this page