Advertisement
TyanColte

Combination Lock

Apr 2nd, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.31 KB | None | 0 0
  1. os.loadAPI("rs")
  2.  
  3. if fs.exists("pass.txt") then
  4.     hRead = assert(fs.open("pass.txt", "r"))
  5.         pass1 = hRead.readLine(1)
  6.         pass2 = hRead.readLine(2)
  7.         pass3 = hRead.readLine(3)
  8.         pass4 = hRead.readLine(4)
  9.             print("User Password:")
  10.             print(pass1)
  11.             print(pass2)
  12.             print(pass3)
  13.             print(pass4)
  14.     hRead.close()
  15.  
  16. if fs.exists("admin.txt") then
  17.     hRead = assert(fs.open("admin.txt", "r"))
  18.         admin1 = hRead.readLine(1)
  19.         admin2 = hRead.readLine(2)
  20.         admin3 = hRead.readLine(3)
  21.         admin4 = hRead.readLine(4)
  22.             print("Admin Password:")
  23.             print(admin1)
  24.             print(admin2)
  25.             print(admin3)
  26.             print(admin4)
  27.     hRead.close()
  28. end
  29.  
  30. a=0
  31. b=0
  32. c=0
  33. d=0
  34. m=0
  35.  
  36. while true do
  37.  
  38.     while true do
  39.         m = rs.getBundledInput("right")
  40.         admin = false
  41.         if m == then
  42.             admin = true
  43.             print("Admin Mode")
  44.         end
  45.  
  46.     repeat
  47.  
  48. a = rs.getBundledInput("right")
  49.  
  50.     if a == 32768 then
  51.         os.reboot()
  52.     end
  53.         print("A")
  54. until a ~= 0
  55. repeat
  56. print("A-")
  57.  
  58. os.pullEvent("redstone")
  59.     b = rs.getBundledInput("right")
  60.         if b == 32768 then
  61.             os.reboot()
  62.         end
  63.     print("B")
  64. until b ~= 0
  65. repeat
  66.  
  67. os.pullEvent("redstone")
  68.     c = rs.getBundledInput("right")
  69.         if c == 32768 then
  70.             os.reboot()
  71.         end
  72.     print("C")
  73. until c ~= 0
  74. repeat
  75.  
  76. os.pullEvent("redstone")
  77.     d = rs.getBundledInput("right")
  78.         if d == 32768 then
  79.             os.reboot()
  80. end
  81. print("D")
  82. until d ~= 0
  83. print(a)
  84. print(b)
  85. print(c)
  86. print(d)
  87.  
  88. if admin then
  89.     print("admin")
  90.         hWrite = fs.open("pass.txt", "w")
  91.             hWrite.writeLine(a)
  92.             hWrite.writeLine(b)
  93.             hWrite.writeLine(c)
  94.             hWrite.writeLine(d)
  95.         hWrite.close()
  96.     os.reboot()
  97. end
  98.  
  99. passc = pass1..pass2..pass3..pass4
  100. adminc = admin1..admin2..admin3..admin4
  101. passi = a..b..c..d
  102.  
  103. if passi== adminc then
  104.     rs.setOutput("top", true)
  105.         sleep(8)
  106.     rs.setOutput("top", false)
  107. end
  108.  
  109. if passi==passc then
  110.     print("Opening Spawn Exit")
  111.         shell.run("OpenD")
  112.             sleep(5)
  113.     shell.run("CloseD")
  114. else
  115.     break
  116. end
  117.  
  118. end
  119. print("cycle")
  120. sleep(1.2)
  121. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement