Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("left")
- monitors={}
- function len(txt)
- return #txt
- end
- while true do
- id,message,distance,protocol=rednet.receive("monitoring")
- if id~=nil then
- if message:sub(1,len("connectToServer:"))=="connectToServer:" then
- rednet.send(id,"successfullyConnected","monitoring")
- name=message:sub(len("connectToServer:")+1)
- print("successfullyConnected: "..id..", "..name)
- monitors[name]={id}
- rednet.send(id,"displayMsg:hu","monitoring")
- elseif message=="ping" then
- rednet.send(id,"successfullyPinged","monitoring")
- else
- print("unknown message: "..message)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement