diff --git a/vmf_source/scripts/mods/vmf/modules/core/network.lua b/vmf_source/scripts/mods/vmf/modules/core/network.lua new file mode 100644 index 0000000..099092d --- /dev/null +++ b/vmf_source/scripts/mods/vmf/modules/core/network.lua @@ -0,0 +1,20 @@ +local vmf = get_mod("VMF") + +local _RPC_CALLBACKS = {} + +VMFMod.rpc_register = function (self, rpc_name, rpc_function) + + if type(rpc_name) ~= "string" then + self:error("(rpc_register): rpc_name should be the string, not %s", type(rpc_name)) + return + end + + if type(rpc_function) ~= "function" then + self:error("(rpc_register): rpc_function should be the function, not %s", type(rpc_name)) + return + end + + _RPC_CALLBACKS[self:get_name()] = _RPC_CALLBACKS[self:get_name()] or {} + + _RPC_CALLBACKS[self:get_name()][rpc_name] = rpc_function +end \ No newline at end of file diff --git a/vmf_source/scripts/mods/vmf/vmf_loader.lua b/vmf_source/scripts/mods/vmf/vmf_loader.lua index b84d121..c85fa18 100644 --- a/vmf_source/scripts/mods/vmf/vmf_loader.lua +++ b/vmf_source/scripts/mods/vmf/vmf_loader.lua @@ -15,6 +15,7 @@ return { dofile("scripts/mods/vmf/modules/core/delayed_chat_messages") dofile("scripts/mods/vmf/modules/core/chat") dofile("scripts/mods/vmf/modules/core/localization") + dofile("scripts/mods/vmf/modules/core/network") dofile("scripts/mods/vmf/modules/gui/custom_textures") dofile("scripts/mods/vmf/modules/gui/custom_menus") dofile("scripts/mods/vmf/modules/gui/ui_scaling")