Integration Hooks
Editable hooks for custom access, theft, dispatch, and logging.
The hooks are unencrypted:
| Side | File |
|---|---|
| Client | client/unlocked/hooks.lua |
| Server | server/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
#CanJamKeyVehicle
Runs before the signal jammer opens. The default implementation blocks jamming inside Zyke Garages sections when lockpicking.blockInGarageSections is enabled. See Signal Jammer.
lua---@param vehicle Vehicle
---@return boolean allowed
---@return string? reason
function CanJamKeyVehicle(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
#IsSignalJammerProtectedVehicle
Decides which vehicles need a signal jam before they can be lockpicked or hotwired. The default implementation protects vehicles with an installed security module, and the models and classes in signalJammer.protectedVehicles. See Protected Vehicles.
lua---@param vehicle Vehicle
---@return boolean protected
function IsSignalJammerProtectedVehicle(vehicle)
if (GetVehicleSecurityModule(vehicle)) then return true end
local protectedVehicles = Config.Settings.signalJammer.protectedVehicles
local model = GetEntityModel(vehicle)
if (protectedVehicles.models[model] == true) then return true end
return protectedVehicles.classes[Z.getVehicleClass(model)] == true
end
#CanJamKeyVehicle
Runs before the server starts a signal jammer attempt.
lua---@param plyId PlayerId
---@param vehicle Vehicle
---@return boolean allowed
---@return string? reason
function CanJamKeyVehicle(plyId, vehicle)
return true
end
#LogKeyAction
Runs for completed lockpick, hotwire, signal jam, security module installation, 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. A failed signal jam (stage = "alarmTriggered") skips the witness check and always counts as witnessed, since the vehicle alarm goes off.
lua---@param data table
function OnKeyRobbery(data)
end