Advertisement
Shuudoushi

password protection API/program for doors

Jan 22nd, 2013
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.19 KB | None | 0 0
  1. -- OUTDATED! Go here http://pastebin.com/W9yH2c10 for the updated version.
  2.  
  3. --This is ready to use out of the box! Just change "<password>" to your password and set your side and your off. This program should be easy enough to modify to suit your needs, thus the "API" part, as it sits it is a VERY simple looking and functioning program. Have fun with it!
  4.  
  5. local side = "<side>" --Change this to that side in which your door is on.
  6. local password = "<password>" --This would be your password.
  7. local sleepTime = 5 --Change this to how long you want the door to stay open.
  8. local debug = "1243" --This is for breaking the program and changing the password or side in which your door is on.
  9. local oldPull = os.pullEvent --This disables CTRL+T.
  10. os.pullEvent = os.pullEventRaw --This disables CTRL+T.
  11.   while true do
  12.    term.clear()
  13.    term.setCursorPos(1,1) --Set this to a value in which you wish the cursor to appear (1,1 places the cursor top left of the screen).
  14.    write("Password:")
  15.    input = read("*") --This makes it so instead of seeing your password, all you see is "*".
  16.   if input == debug then
  17.     term.clear()
  18.     term.setCursorPos(1,1) --Set this to a value in which you wish the cursor to appear.
  19.      print("Entering debug mode...") --You may change this line or remove it (if you remove it also remove the three (3) lines below it).
  20.       sleep(sleepTime)
  21.     term.clear()
  22.     term.setCursorPos(1,1) --Set this to a value in which you wish the cursor to appear.
  23.      break
  24.   elseif input == password then
  25.    term.clear()
  26.    term.setCursorPos(1,1) --Set this to a value in which you wish the cursor to appear.
  27.     print("Password correct!") --You may change this to the message you would like displayed if the password is correct, you can also remove it.
  28.     rs.setOutput(side, true)
  29.     sleep(sleepTime)
  30.     rs.setOutput(side, false)
  31.   else
  32.    term.clear()
  33.    term.setCursorPos(1,1) --Set this to a value in which you wish the cursor to appear.
  34.     print("Password incorrect...") --You may change this to the message you would like to see if the password is incorrect, you can also remove it and the line below it.
  35.     sleep(sleepTime)
  36.  end
  37. end
  38. os.pullEvent = oldPull --This disables CTRL+T.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement