Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- if not fs.exists("webeditor") then
- shell.run("pastebin get qXeRRLxU webeditor")
- end
- term.clear()
- term.setCursorPos(1, 1)
- print("Server ")
- term.setTextColor( colors.lime )
- term.setCursorPos(8,1)
- print("online")
- term.setTextColor( colors.red )
- print("Press s for change mode")
- function loader()
- while true do
- local id, message = rednet.receive()
- print("connecting")
- local filePath = "ids"
- local fileHandle = fs.open (filePath, 'w')
- fileHandle.write (textutils.serialize (id))
- fileHandle.close()
- if fs.exists(tostring(message)) then
- shell.run(message)
- local filePath = "messages"
- local fileHandle = fs.open (filePath, 'w')
- fileHandle.write (textutils.serialize (message))
- fileHandle.close()
- elseif not fs.exists(tostring(message)) then
- rednet.send(id,"Wbn")
- end
- end
- end
- function buttonpress()
- onoff = 1
- while true do
- local event, param = os.pullEvent()
- if event == "key" and param == 31 then -- key 28 is the 'enter' key
- onoff = onoff + 1
- if onoff == 1 then
- term.clear()
- term.setCursorPos(1, 1)
- print("Server ")
- term.setTextColor( colors.lime )
- term.setCursorPos(8,1)
- print("online")
- rednet.open("top")
- elseif onoff == 2 then
- term.clear()
- term.setCursorPos(1, 1)
- term.setTextColor( colors.white )
- print("Server ")
- term.setTextColor( colors.red )
- term.setCursorPos(8,1)
- print("offline")
- rednet.close("top")
- elseif onoff > 2 then
- onoff = 1
- rednet.open("top")
- term.clear()
- term.setCursorPos(1, 1)
- term.setTextColor( colors.white )
- print("Server ")
- term.setTextColor( colors.lime )
- term.setCursorPos(8,1)
- print("online")
- end
- end
- end
- end
- parallel.waitForAll(loader,buttonpress)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement