Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local pullEvent = os.pullEvent
- os.pullEvent = os.pullEventRaw
- --to restore keyboard commands--
- --os.pullEvent = pullEvent--
- local pass = "bacon"
- local admin = "waffleiron"
- local state = 0
- local errornum = 0
- while true do
- while state == 0 do
- term.clear()
- term.setCursorPos(1,1)
- print("Please enter password")
- input = read("x")
- if input == pass then
- redstone.setOutput("left", true)
- sleep(5)
- redstone.setOutput("left", false)
- end
- if input == admin
- print("Key commands enabled")
- os.pullEvent = pullEvent
- end
- if input ~= pass then
- state = 1
- errornum = errornum + 1
- break
- end
- end
- while state == 1 do
- if errornum ~= 3 then
- term.clear()
- term.setCursorPos(1,1)
- print("Wrong password!")
- if errornum == 1 then
- print("Lockout in 2 tries!")
- else
- print("Lockout in 1 try!")
- end
- input = read("x")
- if input ~= pass then
- errornum = errornum + 1
- end
- if input == admin
- print("Key commands enabled")
- os.pullEvent = pullEvent
- end
- if input == pass then
- redstone.setOutput("left", true)
- sleep(5)
- redstone.setOutput("left", false)
- state = 0
- errornum = 0
- break
- end
- elseif errornum == 3 then
- term.clear()
- term.setCursorPos(1,1)
- print("Terminal lockout!")
- print("Waiting for reset...")
- state = 2
- break
- end
- end
- while state == 2 do
- reset = rs.getInput("back")
- if reset == true then
- state = 0
- errornum = 0
- else
- sleep(1)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement