Documentation

Integration Hooks

Editable hooks for custom access, theft, dispatch, and logging.

The hooks are unencrypted:

SideFile
Clientclient/unlocked/hooks.lua
Serverserver/unlocked/hooks.lua

Return false and an optional locale key from a Can... hook to block the action.

#Client Hooks

#CanUseKeyVehicle

Runs before a local lock or engine action.

lua
---@param vehicle Vehicle
---@param action string
---@return boolean allowed
---@return string? reason
function CanUseKeyVehicle(vehicle, action)
    return true
end

#CanLockpickKeyVehicle

Runs before lockpicking. The default implementation can block lockpicking inside Zyke Garages sections.

lua
---@param vehicle Vehicle
---@return boolean allowed
---@return string? reason
function CanLockpickKeyVehicle(vehicle)
    return true
end

#CanHotwireKeyVehicle

lua
---@param vehicle Vehicle
---@return boolean allowed
---@return string? reason
function CanHotwireKeyVehicle(vehicle)
    return true
end

#CanSearchVehicleKeys

lua
---@param vehicle Vehicle
---@return boolean allowed
---@return string? reason
function CanSearchVehicleKeys(vehicle)
    return true
end

#CanRobNpcKeys

lua
---@param ped Ped
---@param vehicle Vehicle
---@return boolean allowed
---@return string? reason
function CanRobNpcKeys(ped, vehicle)
    return true
end

#OnKeyRobbery

Runs for client-detected theft stages. The default implementation checks pedestrian witnesses and leaves a place for client dispatch logic.

lua
---@param data table
function OnKeyRobbery(data)
end

#Server Hooks

#CanUseKeyVehicle

Runs before the server applies a lock or engine action.

lua
---@param plyId PlayerId
---@param vehicle Vehicle
---@param action string
---@return boolean allowed
---@return string? reason
function CanUseKeyVehicle(plyId, vehicle, action)
    return true
end

#CanGiveTemporaryVehicleKey

lua
---@param plyId PlayerId
---@param plate string
---@return boolean allowed
---@return string? reason
function CanGiveTemporaryVehicleKey(plyId, plate)
    return true
end

#CanLockpickKeyVehicle

The default implementation applies the configured temporary, personal, and profession vehicle restrictions.

lua
---@param plyId PlayerId
---@param vehicle Vehicle
---@return boolean allowed
---@return string? reason
function CanLockpickKeyVehicle(plyId, vehicle)
    return true
end

#CanHotwireKeyVehicle

The default implementation applies the configured vehicle-type restrictions.

lua
---@param plyId PlayerId
---@param vehicle Vehicle
---@return boolean allowed
---@return string? reason
function CanHotwireKeyVehicle(plyId, vehicle)
    return true
end

#LogKeyAction

Runs for completed lockpick, hotwire, NPC robbery, and key-theft actions. The default sends logs through zyke_lib/webhooks/vehiclekeys.lua.

lua
---@param data table
function LogKeyAction(data)
end

#OnKeyRobbery

Runs before the server zyke_vehiclekeys:OnKeyRobbery event. The default asks the affected client for witness details and leaves a place for server dispatch logic.

lua
---@param data table
function OnKeyRobbery(data)
end