net/netold/relay.lua
Ryan Ward 859ae91395 Reworking the library
netold contains the older library. the new library has all the core features that  was in the old library.
2018-06-15 11:29:27 -04:00

25 lines
695 B
Lua

require("net")
net:registerModule("relay",{1,0,0})
net.OnServerCreated:connect(function(s)
s.OnDataRecieved(function(self,data,CID_OR_HANDLE,IP_OR_HANDLE,PORT_OR_IP)
local IP=""
if self.Type=="tcp" then
error("Relays only work when using UDP or AUDP! They will not function with TCP! Support may one day be added for TCP!")
else
IP=IP_OR_HANDLE
end
local cmd,dat=data:match("!relay! (%S-) (.+)")
if cmd == "RELAY" then
--
elseif cmd == "LOAD" then
local cpuload=multi:getLoad()
self:send(IP_OR_HANDLE,"!relay! LOAD "..cpuload,PORT_OR_IP)
end
end,"relay")
end)
net.OnClientCreated:connect(function(c)
c.OnDataRecieved(function(self,data)
--
end,"relay")
end)