Can-Check Hooks
Hook functions that run before lift actions are executed. Return false to deny with an optional reason.
Can-check hooks allow you to control player actions in zyke_vehiclelifts before they execute. Return false with an optional locale key to deny an action and notify the player.
Client and server hooks return true by default.
#File Locations
| Side | File |
|---|---|
| Server | server/can_checks.lua |
| Client | client/can_checks.lua |
Both files are unencrypted and safe to edit directly. Edit the existing functions inside Vehicle Lifts.
Types / Classes
All types / classes can be found in
types/types.lua.plyIdis the requesting player's server ID.actionisarmsfor setting a lift's arms, orupordownfor moving it.
#How Reason Strings Work
#Server-side reasons
The server sends the reason to the client, which passes it to Z.notify(), so use a locale key. Missing reasons fall back to "actionUnavailable".
#Client-side reasons
Client checks also use locale keys and fall back to "actionUnavailable". They provide immediate feedback; enforce trusted restrictions in the corresponding server hook. Add custom reason keys to every resource locale.
This server-side example only lets mechanics work the lifts.
Example:
lua---@param plyId PlayerId ---@param liftId integer ---@param action LiftAction ---@return boolean allowed ---@return string? reason function CanWorkLift(plyId, liftId, action) if (not Z.isJob(plyId, "mechanic")) then return false, "noPermission" end return true end
#Execution & Validation
Keep hooks synchronous and free of side effects. Returning true continues the normal flow; built-in distance, vehicle, pad, and busy checks still apply. The server hook runs before the rules other resources register through RegisterLiftRules.
The admin command and lifts removed or set down by the resource are not subject to player action hooks.
#Server-Sided Hooks
All server-sided hooks are in server/can_checks.lua.
#Can Work Lift
Called before a player sets a lift's arms, or sends its carriages up or down.
Example:
lua---@param plyId PlayerId ---@param liftId integer ---@param action LiftAction ---@return boolean allowed ---@return string? reason function CanWorkLift(plyId, liftId, action) return true end
#Client-Sided Hooks
All client-sided hooks are in client/can_checks.lua.
#Can Work Lift
Called before the client asks the server to set the arms or move the lift. The server re-validates every action.
Example:
lua---@param liftId integer ---@param action LiftAction ---@return boolean allowed ---@return string? reason function CanWorkLift(liftId, action) return true end
#Server Hooks
server/hooks.lua holds OnLiftMoved, which runs whenever a player sends a lift up or down. It receives the same data as the zyke_vehiclelifts:OnLiftMoved event. Add dispatch exports or custom logic there.
Example:
lua---@param data LiftHookData function OnLiftMoved(data) -- Add dispatch exports or custom logic here end