Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sleepTime = 2.5
- local debug = "0000" -- This can be changed to anything you want. If you are going to be using this program to protect a ComputerCraft computer, use this code and don't worry about making the rest of the files.
- local oldPull = os.pullEvent
- s = fs.open(".doorSide", "r") --.doorSide, .passWord and .userName hidden text files need to be made for this program to work for doors. And I hope what should be in these files is not needed to be said...
- texts = s.readAll()
- s.close()
- p = fs.open(".passWord", "r")
- textp = p.readAll()
- p.close()
- u = fs.open(".userName", "r")
- textu = u.readAll()
- u.close()
- os.pullEvent = os.pullEventRaw
- while true do
- term.clear()
- term.setCursorPos(1,1)
- write("User: "..textu)
- term.setCursorPos(1,2)
- write("Password: ")
- input = read("*")
- if input == debug then
- term.clear()
- term.setCursorPos(1,1)
- print("Entering debug mode...")
- sleep(sleepTime)
- term.clear()
- term.setCursorPos(1,1)
- break
- elseif input == textp then
- term.clear()
- term.setCursorPos(1,1)
- write("Password correct!")
- rs.setOutput(texts, true)
- sleep(sleepTime)
- rs.setOutput(texts, false)
- else
- term.clear()
- term.setCursorPos(1,1)
- write("Password incorrect...")
- sleep(sleepTime)
- end
- end
- os.pullEvent = oldPull
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement