Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Settings
- passwords={"PepsiMax", "PepsiMin"} --password(s) for the terminal
- side="left" --side to activate on correct password
- lockout=2 --lockout period after incorrect password
- matchcase=true --require capital/lowercase letters to match?
- function passprompt()
- term.clear()
- term.setCursorPos(1,1)
- term.write("Enter password: ")
- entry=io.read()
- for i=1, #passwords do
- if((entry==passwords[i]) or ((matchcase == false) and (string.lower(value) == string.lower(passwords[i])))) then
- term.write("correct.")
- cycledoor()
- return true
- end
- end
- term.write("incorrect.")
- sleep(2)
- end
- function cycledoor()
- redstone.setOutput(side, true)
- sleep(5)
- redstone.setOutput(side, false)
- end
- os.pullEvent = os.pullEventRaw
- while true do passprompt() end
Advertisement
Add Comment
Please, Sign In to add comment