Advertisement
Thedukeofcrawley

Untitled

Aug 15th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. local component=require("component")
  2. local term=require("term")
  3. local text=require("text")
  4. local computer=require("computer")
  5. local os=require("os")
  6. local alarm=component.os_alarm
  7. local rs=component.redstone
  8. local gpu=component.gpu
  9.  
  10. ----Config----
  11. local delay1=7 --The delay what the redstone is on for (1)
  12. local delay2=7 --The delay what the redstone is on for (2)
  13. local delaywrong=3
  14. local side1=0 --The redstone side (1)
  15. local side2=0 --The redstone side (2)
  16. local username1="001" --Username (1)
  17. local username2="002" --Username (2)
  18. local password1="federal" --Password (1)
  19. local password2="reserve" --Password (2)
  20. local usernameline=31
  21. local passwordline=36
  22. local firstmsg="Unity City Federal Reserve" --The message that appears when the program is started
  23. local username="Please enter your badgenumber:"
  24. local password="Please enter your personal password"
  25. local passwordwrong="Wrong password!"
  26. local usernamewrong="Wrong badgenumber"
  27. local alarmrange=150
  28. ---- ---- ----
  29.  
  30. alarm.setRange(alarmrange)
  31.  
  32. while true do
  33. term.clear()
  34. gpu.set(1,1,firstmsg)
  35. term.setCursor(1,2)
  36. gpu.set(1,3,username)
  37. term.setCursor(usernameline,3)
  38. local username=io.read()
  39. if username==username1 then
  40. gpu.set(1,4,password)
  41. term.setCursor(passwordline,4)
  42. local password = text.trim(term.read(nil, false, nil, "*"))
  43. if password==password1 then
  44. alarm.deactivate()
  45. rs.setOutput(1,15)
  46. os.sleep(delay1)
  47. rs.setOutput(1,0)
  48. else
  49. if username==username2 then
  50. term.setCursor(passwordline,4)
  51. local password = text.trim(term.read(nil, false, nil, "*"))
  52. if password==password2 then
  53. alarm.deactivate()
  54. rs.setOutput(2,15)
  55. os.sleep(delay2)
  56. rs.setOutput(2,0)
  57. else
  58. gpu.set(1,6,passwordwrong)
  59. alarm.activate()
  60. os.sleep(delaywrong)
  61. end
  62. else
  63. gpu.set(1,6,usernamewrong)
  64. os.sleep(delaywrong)
  65. end
  66. end
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement