Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw -- Prevent user from terminating program
- local side = "" -- Side to output redstone
- local password = "" -- Password to type to gain access
- local admin = "" -- Password to terminate program
- local time = 0 -- Enter time to output redstone for (seconds)
- local open = true -- Redstone value to output if door is closed
- while true do
- rs.setOutput(side, open) -- Makes sure redstone is outputting correctly
- term.clear()
- term.setCursorPos(1, 1)
- write("Enter access code: ")
- local input = read("*")
- if input == password then
- print("Access granted!")
- print("Opening door for " .. time .. " seconds...")
- rs.setOutput(side, not open)
- sleep(time)
- rs.setOutput(side, open)
- elseif input == admin then
- write("Terminating program in 3")
- sleep(1)
- write(", 2")
- sleep(1)
- print(", 1")
- sleep(1)
- break;
- else
- print("Access denied")
- sleep(2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement