Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chatbox = peripheral.wrap("bottom")
- local monitor = peripheral.wrap("top")
- local auth = peripheral.wrap("left")
- local listen = false
- local permitEveryone = false
- local function cls(periph)
- periph.clear()
- periph.setCursorPos(1,1)
- end
- local function newLine(periph)
- local cx, cy = periph.getCursorPos()
- periph.setCursorPos(1,cy +1)
- end
- local function terminate()
- cls(term)
- term.write("Click Player detector to terminate!")
- local event, p1 = os.pullEvent("player")
- if p1 == "mariomarco" then
- newLine(term)
- term.write("Bye bye...")
- exit()
- end
- end
- cls(monitor)
- cls(term)
- while true do
- local event, p1, p2, p3 = os.pullEventRaw()
- redstone.setOutput("right", true)
- if p1 == nil then p1 = "" end
- if p2 == nil then p2 = "" end
- if p3 == nil then p3 = "" end
- if listen == true then
- cls(monitor)
- monitor.write("Pulled " .. event)
- newLine(monitor)
- monitor.write(p1 .. " " .. p2 .. " " .. p3)
- newLine(monitor)
- end
- if event == "chat" then
- if p1 == "mariomarco" and permitEveryone == false then
- if p2 == "rob allow Everyone" then permitEveryone = true end
- if p2 == "rob stop listening" then listen = false end
- if p2 == "rob start listening" then listen = true end
- if p2 == "rob toggle listening" then listen = not(listen) end
- if p2 == "rob redownload" then shell.run("startup") end
- if p2 == "rob terminate" then terminate() end
- if p2 == "rob time" then
- local site = http.get("http://mariomarco.funpic.de/others/TIME.php?format=G:i")
- if site == nil then
- chatbox.say("site down")
- else
- chatbox.say(site.readAll())
- site.close()
- end
- end
- if p2 == "rob time2" then
- local site = http.get("http://mariomarco.funpic.de/others/TIME.php?format=G:i:s")
- if site == nil then
- chatbox.say("site down")
- else
- chatbox.say(site.readAll())
- site.close()
- end
- end
- end
- if p1 == "mariomarco" or permitEveryone == true then
- if p1 == "mariomarco" then
- if p2 == "rob disallow Everyone" then permitEveryone = false end
- if p2 == "rob redownload" then shell.run("startup") end
- if p2 == "rob terminate" then terminate() end
- end
- if p2 == "rob time" then
- local site = http.get("http://mariomarco.funpic.de/others/TIME.php?format=G:i")
- if site == nil then
- chatbox.say("site down")
- else
- chatbox.say(site.readAll())
- site.close()
- end
- end
- if p2 == "rob time2" then
- local site = http.get("http://mariomarco.funpic.de/others/TIME.php?format=G:i:s")
- if site == nil then
- chatbox.say("site down")
- else
- chatbox.say(site.readAll())
- site.close()
- end
- end
- end
- end
- redstone.setOutput("right", false)
- if event == "terminate" then
- terminate()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment