Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local pullEvent = os.pullEvent
- os.pullEvent = os.pullEventRaw
- local modem = "right"
- local cpid = 4
- local cpmsg = "open my door"
- local side = "back"
- local password = "welcome to my house"
- local debug = "debug pass"
- local opentime = 5
- rednet.open(modem)
- function main_loop()
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("Mot de passe: ")
- local input = read()
- if input == password then
- term.clear()
- term.setCursorPos(1,1)
- print("Bienvenue chez vous !")
- rs.setOutput(side,true)
- sleep(opentime)
- rs.setOutput(side,false)
- os.reboot()
- end
- if input == debug then
- term.clear()
- term.setCursorPos(1,1)
- print("Debug Enabled")
- os.pullEvent = pullEvent
- else
- print("Mot de passe incorecte !")
- sleep(2)
- end
- end
- end
- function rednet_open()
- while true do
- id,msg = rednet.receive()
- if id == cpid and msg == cpmsg then
- term.clear()
- term.setCursorPos(1,1)
- print("Porte ouverte")
- rs.setOutput(side,true)
- sleep(opentime)
- rs.setOutput(side,false)
- rednet.close(modem)
- os.reboot()
- end
- end
- end
- parallel.waitForAny(rednet_open,main_loop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement