An elevator-level restriction disables all floors of the elevator if the condition evaluates to false. This type of restriction ensures that users are entirely restricted from using the elevator.
You can find all of the examples in no-elevators/restrictions/examples folder.
Example
local API = exports["no-elevators"]
local function isAdmin(source)
return IsPlayerAceAllowed(source, "elevators.admin")
end
--In these examples:
-- "admin" refers to the elevator ID.
-- {"admin", "admin2", "admin3"} applies the restriction to multiple elevators.
-- isAdmin serves as the controller function, returning true or false.
-- Apply restriction to a single elevator
---@param elevatorIds table<string> | string
---@param controller fun -> boolean
API:AddElevatorRestriction("admin", isAdmin)
-- Apply restriction to multiple elevators
---@param elevatorIds table<string> | string
---@param controller fun -> boolean
API:AddElevatorRestriction({"admin", "admin2", "admin3"}, isAdmin)