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 bucketmode:'networked' | 'local'nearest:integer?— id of the door in reachstaff:table?—{ save, remove, lock, key, bypass, teleport }, nil for a playerapplied: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 }; errordoorlock.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; errordoorlock.noDoor
Use
ox's useClosestDoor: asks to flip the door the player stands at.
doorlock.Use(origin)Parameters
- origin?:
string— default'contract'
Returns
Result—trueonce sent; errordoorlock.noDoor
local sent = doorlock.Use('mymodule')
if not sent.ok then print('no door here') endPickClosest
ox's pickClosestDoor: starts a lockpick on the door in reach.
doorlock.PickClosest()Returns
Result—trueonce sent; errordoorlock.noDoor
OpenStaff
Opens the staff panel. The server still checks every write.
doorlock.OpenStaff()Returns
Result— errordoorlock.notStafffor a player withoutcommand.opx.doorlock