Update impl.lua

This commit is contained in:
Lorraxs 2023-12-10 04:56:28 +07:00
parent cddb2ff6ad
commit 499d1d00ef

View File

@ -114,11 +114,18 @@ end
function Impl:Destroy()
self.destroyed = true
main:LogInfo("%s destroyed", self.name)
for k, v in pairs(self.eventHandlers) do
RemoveEventHandler(v)
end
self:OnDestroy()
end
function Impl:OnReady(...)
end
function Impl:OnDestroy(...)
end
function Impl:HookMethod(method, hookFn)
local oldMethod = self[method]
if not oldMethod then
@ -196,6 +203,14 @@ function Impl:Off(name, handler)
main:LogError("Event %s:%s not registered", self.name, name)
end
function Impl:AddEventHandler(eventName, ...)
self.eventHandlers[eventName] = AddEventHandler(eventName, ...)
end
function Impl:RegisterNetEvent(eventName, ...)
self.eventHandlers[eventName] = RegisterNetEvent(eventName, ...)
end
if env == 'sv' then
function Impl:Callback(impl, name, source, ...)
if type(impl) == "object" then