Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("back")
- local protocol = "gate-security"
- local hostname = "server"
- local password = "secure"
- local opentime = 5
- local monitor = peripheral.wrap("top")
- redstone.setOutput("bottom", true)
- monitor.setBackgroundColor(colors.lime)
- monitor.clear()
- rednet.host(protocol, hostname)
- local function opengate()
- redstone.setOutput("bottom", false)
- sleep(opentime)
- redstone.setOutput("bottom", true)
- end
- local function receiveRednet()
- local id, message, protocol = rednet.receive()
- print(tostring(id))
- print(tostring(message))
- if tostring(message) == password then
- print("rednet, opengate")
- opengate()
- end
- end
- local function receiveTouch()
- local event = os.pullEvent("monitor_touch")
- print("monitor, opengate")
- monitor.setBackgroundColor(colors.red)
- monitor.clear()
- opengate()
- monitor.setBackgroundColor(colors.lime)
- monitor.clear()
- end
- while true do
- parallel.waitForAny(receiveRednet, receiveTouch)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement