OC-MultICE/modules/net/nshd-auth.lua

39 lines
893 B
Lua
Raw Normal View History

2017-06-26 22:10:12 +10:00
function nshds_w(evPP,cA,sI,pW)
s("nshds - "..tostring(sI),function()
chauths(cA,evPP,pW)
luash({["sI"]=sI})
while true do
if ev[1] == "net_msg" then
local msg=tostring(ev[4])
if ev[3] == evPP and ev[2] == cA then
if msg:sub(1,3) == "key" then
h("key",tT[cT][3].sI,tonumber(msg:sub(4)),0)
elseif msg == "exit" then pcall(killsession,sI) break
end
end
elseif ev[1] == "display" and ev[3] == tT[cT][3].sI then
ns(cA,evPP,"dis"..tostring(ev[2]))
end
C.yield()
end
end,{["sI"]=sI})
end
function nshds(P,pW)
s("nshds",function()
local Cc=1
while true do
if ev[1] == "net_msg" and ev[3] == P then
if ev[4] == "initnsh" then
nnID="nsh-"..tostring(Cc)
Cc=Cc+1
ns(ev[2],P,nnID)
nshds_w(nnID,ev[2],nnID,pW)
print("[nshds]Spawned "..nnID.." for "..tostring(ev[2]))
end
end
C.yield()
end
end,{["sI"]="log"})
end