Documentation

Can-Check Hooks

Hook functions that decide who may carry, fit and remove snow chains. Return false to deny.

Can-check hooks allow you to control who may carry, fit and remove snow chains. By default they only check the job list in Config.Settings.jobs. Return false to deny an action; the player is told they aren't allowed.

#File Locations

SideFile
Serverserver/unlocked/can_checks.lua
Clientclient/unlocked/can_checks.lua

Both files are unencrypted and safe to edit directly. The client hook only decides whether the wheel markers show; the server hooks are the ones that enforce your rules, so change both.


#Server-Sided Hooks

All server-sided hooks are in server/unlocked/can_checks.lua.

#Can Carry Snow Chain

Called when a player takes a chain out to fit it, before walking to a wheel. This covers both the item and the command.

Example:

lua
---@param plyId integer
---@return boolean allowed
function CanCarrySnowChain(plyId)
    return hasChainJob(plyId)
end

#Can Fit Snow Chain

Called before a player fits a chain to a wheel.

Example:

lua
---@param plyId integer
---@param vehicle integer
---@param bone string @ Wheel bone the chain goes on, such as "wheel_lf"
---@return boolean allowed
function CanFitSnowChain(plyId, vehicle, bone)
    return hasChainJob(plyId)
end

#Can Remove Snow Chain

Called before a player removes a chain from a wheel.

Example:

lua
---@param plyId integer
---@param vehicle integer
---@param bone string @ Wheel bone the chain comes off, such as "wheel_lf"
---@return boolean allowed
function CanRemoveSnowChain(plyId, vehicle, bone)
    return hasChainJob(plyId)
end

#Client-Sided Hooks

#Can Work On Snow Chains

Decides whether the wheel markers show to this player. Mirror your server rules here so players who can't fit chains don't see the markers.

Example:

lua
---@return boolean allowed
function CanWorkOnSnowChains()
    local jobs = Config.Settings.jobs
    if (not jobs) then return true end

    return Z.isJob(jobs)
end

#Common Patterns

#Let Anyone Fit Chains but Only Mechanics Remove Them

Keep Config.Settings.jobs = false, and check the job in the server removal hook.

Example:

lua
---@param plyId integer
---@param vehicle integer
---@param bone string
---@return boolean allowed
function CanRemoveSnowChain(plyId, vehicle, bone)
    return Z.isJob(plyId, "mechanic")
end