Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- By Tobast
- os.pullEvent = os.pullEventRaw
- -- SETTINGS
- PASSWORD = "CHANGE ME"
- MAINTENANCE_PASS = "MAINTENANCE"
- SIDE = "bottom"
- DELAY = 5
- -- END SETTINGS
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function newline()
- x,y = term.getCursorPos()
- term.setCursorPos(1,y+1)
- end
- badPasswdCount = 0
- while true do
- clear()
- write("Please type in the access code.")
- newline()
- passwd = read("*")
- if passwd == PASSWORD then
- clear()
- if badPasswdCount > 0 then
- write(tostring(badPasswdCount).." wrong tries!")
- badPasswdCount=0
- newline()
- newline()
- end
- write("Access granted!")
- redstone.setOutput(SIDE, true)
- sleep(DELAY)
- redstone.setOutput(SIDE, false)
- elseif passwd == MAINTENANCE_PASS then
- clear()
- write("Don't forget to reboot when you're done!")
- newline()
- break
- else
- clear()
- write("Access denied.")
- badPasswdCount = badPasswdCount + 1
- sleep(1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement