Skip to content

Native Server API ‐ Events

Jonas Söderberg edited this page Jul 13, 2024 · 5 revisions

Important!

Before defining any event handler function, you should store any existing reference and make sure you call it first thing in your function. Otherwise, other addons depending on said event will break!

local _oldOnCustomGameData = OnCustomGameData
OnCustomGameData = function(typeId, id, prev, cur)
    if _oldOnCustomGameData then _oldOnCustomGameData(typeId, id, prev, cur) end
    
    -- Your code here
end

Functions

OnCustomGameData

OnCustomGameData(int: typeId, int: id, float: prev, float: cur) -> ?

Called at the start of sending data to the client

OnCustomGameDataFinish

OnCustomGameDataFinish() -> ?

Called after the transaction is finished and all data is available

OnCustomGameInit

OnCustomGameInit() -> ?

Called after initializing the custom data the first time, for example after login