Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1,1)
- modem = peripheral.wrap("back")
- print("Please Enter Password:")
- local input = read(" ")
- if input == "test" then
- term.clear()
- term.setBackgroundColor(colors.gray)
- term.setCursorPos(1,1)
- print("Please Enter A PORT:")
- local str_port = read()
- if str_port <= "65535" then
- term.clear()
- term.setCursorPos(1,1)
- port = tonumber(str_port)
- modem.open(port)
- print("Username:")
- local usr = read()
- function Listener()
- while true do
- event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- if message ~= "" then
- print(message)
- print("")
- end
- end
- end
- function SendMsg()
- while true do
- local event, param = os.pullEvent()
- if event == "key" and param == 28 then
- write(usr..": ")
- local msg = read()
- if msg ~= "" then
- modem.transmit(port,port,usr..": "..msg)
- end
- elseif event == "key" and param == 53 then
- print("############")
- write("COMMAND: ")
- local svid = tonumber(read())
- if svid ~= "" then
- local cmd = read()
- if cmd ~= "" then
- if svid == 0000 then
- print("############")
- if cmd == "CLR" then
- term.clear()
- term.setCursorPos(1,1)
- elseif cmd == "RBT" then
- os.reboot()
- end
- else
- modem.transmit(port,tonumber(svid),cmd)
- print("############")
- end
- end
- end
- end
- end
- end
- if usr ~= "" then
- term.clear()
- term.setCursorPos(1,1)
- parallel.waitForAny(Listener,SendMsg)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement