Advertisement
KingKj52

password door compcraft

Mar 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. local pullEvent = os.pullEvent
  2. os.pullEvent = os.pullEventRaw
  3. local outSide = "front"
  4. local inSide = "right"
  5. term.setBackgroundColor(colors.green)
  6. local password = "dicks"
  7. local exPass = "yyuula"
  8. local openTime = 5
  9. while true do
  10.  term.clear()
  11.  term.setCursorPos(18,4)
  12.  term.setTextColor(colors.orange)
  13.  print("The Lumber Yard")
  14.  term.setCursorPos(9,6)
  15.  print("Where real men go for ")
  16.  term.setCursorPos(31,6)
  17.  term.setTextColor(colors.brown)
  18.  print("WOOD")
  19.  term.setCursorPos(12,9)
  20.  term.setTextColor(colors.red)
  21.  print("Please enter the password: ")
  22.  term.setTextColor(colors.blue)
  23.  term.setCursorPos(23,11)
  24.  local input = read("*")
  25.  term.setCursorPos(20,12)
  26.  if input == password then
  27.   term.setTextColor(colors.red)
  28.   print("Access granted.")
  29.   rs.setOutput(outSide,true)
  30.   while rs.getInput(inSide) == false do
  31.    sleep(1)
  32.   end
  33.   sleep(openTime)
  34.   rs.setOutput(outSide,false)
  35.   while rs.getInput(inSide) == false do
  36.    sleep(1)
  37.   end
  38.   rs.setOutput(outSide,true)
  39.   while rs.getInput(inSide) == false do
  40.    sleep(1)
  41.   end
  42.   sleep(openTime)
  43.   rs.setOutput(outSide,false)
  44.  elseif input == exPass then
  45.   os.pullEvent = pullEvent
  46.  else
  47.   print("Password incorrect!") -- Prints 'Password incorrect!' to the screen
  48.   sleep(2) -- Waits 2 seconds
  49.  end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement