Documentation

Exports & Events

Exports and server events for catalytic integrations.

General Information

Vehicle arguments are network IDs. Plates are compared trimmed and case-insensitive. Missing converters are kept by plate, so a respawned vehicle with the same plate still runs rough until a converter is installed.

Types / Classes

All types / classes can be found in types/types.lua inside zyke_catalytic.

#Complete Export Index

ContextExports
ServerIsConverterMissing, SetConverterMissing

#Server Sided Exports

#Is Converter Missing

Returns whether a vehicle has no converter. Accepts a vehicle network ID or a plate string, so garage and mechanic resources can check stored vehicles. Expired records return false.

Example:

lua
---@param vehicleOrPlate integer | string @ Network ID or plate
---@return boolean missing
local missing = exports["zyke_catalytic"]:IsConverterMissing(vehicleOrPlate)

#Set Converter Missing

Removes or restores a vehicle's converter by network ID, updating its plate record and effects. Returns false when the network ID does not resolve to a vehicle. Use it from mechanic or garage resources.

Example:

lua
---@param netId integer
---@param missing boolean @ true removes the converter, false restores it
---@return boolean updated
local updated = exports["zyke_catalytic"]:SetConverterMissing(netId, missing)

SetConverterMissing is a trusted server operation. It bypasses player action hooks, items, and permission checks. Do not expose it directly through an unrestricted network event.

#State Bags

State BagTypeMeaning
catalyticRemovedbooleantrue on a vehicle entity while it has no converter.

#Server Local Events

These events are local server integration notifications. They are not network event entry points. Listen with AddEventHandler on the server. Default Discord logging for these events lives in server/unlocked/hooks.lua.

#On Converter Stolen

Fires after a converter is cut out and added to the player's inventory. guard names the guard cut off first, if any.

Example:

lua
---@param data ConverterHookData
AddEventHandler("zyke_catalytic:OnConverterStolen", function(data)
    print(data.source, data.plate, data.model, data.size, data.guard)
end)

#On Converter Installed

Fires after a replacement is installed. size is universal for an installed replacement.

Example:

lua
---@param data ConverterHookData
AddEventHandler("zyke_catalytic:OnConverterInstalled", function(data)
    print(data.source, data.plate, data.model)
end)

#On Converters Sold

Fires when converters are sold outright to a fence. fenceIndex is the index in fence.positions, sold the number of converters, total the money paid, and rep the reputation earned.

Example:

lua
---@param data {source: integer, fenceIndex: integer, sold: integer, total: integer, rep: integer}
AddEventHandler("zyke_catalytic:OnConvertersSold", function(data)
    print(data.source, data.sold, data.total)
end)

#On Converter Alert

Fires when a car alarm goes off or NPCs witness a cut. type is alarm or witness. For dispatch, prefer editing OnConverterAlert in server/unlocked/hooks.lua, which receives the same data.

Example:

lua
---@param data ConverterAlertData
AddEventHandler("zyke_catalytic:OnConverterAlert", function(data)
    print(data.type, data.plate, data.coords)
end)

#On Contract Accepted

Fires when a player takes a contract. type is spec, model, or target.

Example:

lua
---@param data ContractAcceptedData
AddEventHandler("zyke_catalytic:OnContractAccepted", function(data)
    print(data.identifier, data.contractId, data.type, data.payout)
end)

#On Contract Finished

Fires when a contract is handed in, runs out, is dropped, or is cancelled by an admin. status is completed, expired, abandoned, or cancelled. rating is excellent, good, close, poor, or wrong on hand-ins.

Example:

lua
---@param data ContractFinishedData
AddEventHandler("zyke_catalytic:OnContractFinished", function(data)
    print(data.identifier, data.status, data.rating, data.payout)
end)

#On Contract Reputation Changed

Fires when a player's fence reputation changes. amount is the change and reputation the new total. reason is a hand-in rating, expired, abandoned, idle, sale, or admin.

Example:

lua
---@param data ContractReputationData
AddEventHandler("zyke_catalytic:OnContractReputationChanged", function(data)
    print(data.identifier, data.amount, data.reputation, data.reason)
end)

#On Admin Action

Fires when an admin uses an action in the admin panel or the admin vehicle target. target is a character identifier, a plate, or market.

Example:

lua
---@param data ConverterAdminActionHookData
AddEventHandler("zyke_catalytic:OnAdminAction", function(data)
    print(data.source, data.action, data.target, data.value)
end)

#Client Local Events

These are local integration notifications, not server-authorized requests.

#On Player Setting Changed

Fires when the player toggles a personal setting. Receives the setting key and its new value.

Example:

lua
---@param key string
---@param enabled boolean
AddEventHandler("zyke_catalytic:OnPlayerSettingChanged", function(key, enabled)
    print(key, enabled)
end)

For custom permission rules, use Can-Check Hooks.