Guest User

Untitled

a guest
Apr 27th, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. --Settings
  2. passwords={"PepsiMax", "PepsiMin"} --password(s) for the terminal
  3. side="left"                        --side to activate on correct password
  4. lockout=2                          --lockout period after incorrect password
  5. matchcase=true                     --require capital/lowercase letters to match?
  6.  
  7. function passprompt()
  8.   term.clear()
  9.   term.setCursorPos(1,1)
  10.   term.write("Enter password: ")
  11.   entry=io.read()
  12.   for i=1, #passwords do
  13.     if((entry==passwords[i]) or ((matchcase == false) and (string.lower(value) == string.lower(passwords[i])))) then
  14.       term.write("correct.")
  15.       cycledoor()
  16.       return true
  17.     end
  18.   end
  19.   term.write("incorrect.")
  20.   sleep(2)
  21. end
  22.  
  23. function cycledoor()
  24.   redstone.setOutput(side, true)
  25.   sleep(5)
  26.   redstone.setOutput(side, false)
  27. end
  28.  
  29. os.pullEvent = os.pullEventRaw
  30. while true do passprompt() end
Advertisement
Add Comment
Please, Sign In to add comment