You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
911 B
31 lines
911 B
local RakLuaDll = require "RakLuaDll"
|
|
|
|
addEventHandler("onScriptTerminate", function(scr) if scr == script.this then RakLuaDll.destroyHandlers() end end)
|
|
|
|
local events = {
|
|
["onSendRpc"] = RakLuaEvents.OUTGOING_RPC,
|
|
["onSendPacket"] = RakLuaEvents.OUTGOING_PACKET,
|
|
["onReceiveRpc"] = RakLuaEvents.INCOMING_RPC,
|
|
["onReceivePacket"] = RakLuaEvents.INCOMING_PACKET
|
|
}
|
|
|
|
local addEventHandler_orig = addEventHandler
|
|
|
|
function hookAddEventHandler(event, func)
|
|
if events[event] then
|
|
RakLuaDll.registerHandler(events[event], func)
|
|
else
|
|
addEventHandler_orig(event, func)
|
|
end
|
|
end
|
|
|
|
function defineSampLuaCompatibility()
|
|
RakLuaDll.defineGlobals()
|
|
|
|
addEventHandler = hookAddEventHandler
|
|
isSampfuncsLoaded = function() return true end
|
|
end
|
|
|
|
RakLuaDll.defineSampLuaCompatibility = defineSampLuaCompatibility
|
|
|
|
return RakLuaDll
|
|
|