OPX//77
opx_infinityelevators

Server

Last updated on

The elevators contract on the server — floor lists and the job gate for a player.

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

From server code inside opx_infinity. Every function answers { ok, value } / { ok = false, error } and does not yield.

Floors

Every floor and whether this player may use it. Hidden floors are left out when DENIED_FLOORS = 'hidden'.

elevators.Floors(source, elevatorKey)

Parameters

  • source: integer
  • elevatorKey: string

Returns

  • Result { elevator, floors = { { index, label, ok, error?, reason? } } }

IsFloorAllowed

Job gate only: no distance or bucket check.

elevators.IsFloorAllowed(source, elevatorKey, floorIndex)

Parameters

  • source: integer
  • elevatorKey: string
  • floorIndex: integer — the native floor index (INDEX).

Returns

  • Result { elevator, floor, label } — errors: the job-gate codes or no_such_floor
Example
local gate = elevators.IsFloorAllowed(source, 'ncpd_watson', 3)
if not gate.ok then print(gate.error) end -- e.g. off_duty

State

Lifts this server has adopted.

elevators.State()

Returns

  • Result { adopted = { [key] = { id, floorCount, used } } }

On this page