Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. --[[
  2. Made by Colescott Security
  3. ]]
  4.  
  5. os.pullEvent = os.pullEventRaw
  6. shell.openTab("lock2")
  7. sleep(0.1)
  8. shell.switchTab(2)
  9.  
  10.  
  11. m = peripheral.wrap("back")
  12. m.clear()
  13. m.setTextScale(0.5)
  14. m.setBackgroundColor(colors.black)
  15. m.setTextColor(colors.white)
  16.  
  17. load = fs.open("Config", "r")
  18. code,autoReset,waitTime,redstoneSide = unpack(textutils.unserialize(load.readAll()))
  19. load.close()
  20.  
  21. inp = {}
  22. sPos = 4
  23.  
  24.  
  25. function mGUI()
  26. gui = {
  27. [[ CS Enterprise ]],
  28. [[ Security ]],
  29. [[ +-----------+ ]],
  30. [[ | | ]],
  31. [[ +---+---+---+ ]],
  32. [[ | 1 | 2 | 3 | ]],
  33. [[ | 4 | 5 | 6 | ]],
  34. [[ | 7 | 8 | 9 | ]],
  35. [[ | X | 0 | > | ]],
  36. [[ +---+---+---+ ]],
  37. }
  38. m.setTextColor(colors.red)
  39. for i = 1,10 do
  40. m.setCursorPos(1,i)
  41. if i == 3 then
  42. m.setTextColor(colors.white)
  43. end
  44. m.write(gui[i])
  45. end
  46. m.setCursorPos(3,9)
  47. m.setBackgroundColor(colors.red)
  48. m.write(" X ")
  49. m.setCursorPos(11,9)
  50. m.setBackgroundColor(colors.lime)
  51. m.write(" > ")
  52. m.setCursorPos(3,4)
  53. m.setBackgroundColor(colors.lightGray)
  54. m.write(" ")
  55. end
  56.  
  57. function open()
  58. if autoReset then
  59. if waitTime == 0 then waitTime = 2 end
  60. sleep(waitTime)
  61. rs.setOutput(redstoneSide,false)
  62. os.reboot()
  63. else
  64. m.setBackgroundColor(colors.black)
  65. m.clear()
  66. m.setTextScale(5)
  67. m.setCursorPos(1,1)
  68. m.write("<")
  69. ev, side, xPos, yPos = os.pullEvent("monitor_touch")
  70. rs.setOutput(redstoneSide,false)
  71. os.reboot()
  72. end
  73. end
  74.  
  75. function checkInp()
  76. if #inp == #code then
  77. for f = 1,#code do
  78. if inp[f] == code[f] then
  79. if f == #code then
  80. m.setCursorPos(3,4)
  81. m.setBackgroundColor(colors.lime)
  82. m.write(" CORRECT! ")
  83. rs.setOutput(redstoneSide,true)
  84. open()
  85. end
  86. else
  87. m.setCursorPos(3,4)
  88. m.setBackgroundColor(colors.red)
  89. m.write("WRONG CODE!")
  90. sleep(3)
  91. os.reboot()
  92. end
  93. end
  94. else
  95. m.setCursorPos(3,4)
  96. m.setBackgroundColor(colors.red)
  97. m.write("WRONG CODE!")
  98. sleep(3)
  99. os.reboot()
  100. end
  101. end
  102.  
  103. function input()
  104. mGUI()
  105. while true do
  106. ev, side, xPos, yPos = os.pullEvent("monitor_touch")
  107. print(xPos..":"..yPos)
  108. if ev == "monitor_touch" then
  109. if xPos > 2 and xPos < 6 and yPos == 6 then
  110. table.insert(inp,1)
  111. m.setCursorPos(sPos,4)
  112. m.write("*")
  113. sPos = sPos+1
  114. elseif xPos > 6 and xPos < 10 and yPos == 6 then
  115. table.insert(inp,2)
  116. m.setCursorPos(sPos,4)
  117. m.write("*")
  118. sPos = sPos+1
  119. elseif xPos > 10 and xPos < 14 and yPos == 6 then
  120. table.insert(inp,3)
  121. m.setCursorPos(sPos,4)
  122. m.write("*")
  123. sPos = sPos+1
  124. elseif xPos > 3 and xPos < 5 and yPos == 7 then
  125. table.insert(inp,4)
  126. m.setCursorPos(sPos,4)
  127. m.write("*")
  128. sPos = sPos+1
  129. elseif xPos > 7 and xPos < 9 and yPos == 7 then
  130. table.insert(inp,5)
  131. m.setCursorPos(sPos,4)
  132. m.write("*")
  133. sPos = sPos+1
  134. elseif xPos > 11 and xPos < 13 and yPos == 7 then
  135. table.insert(inp,6)
  136. m.setCursorPos(sPos,4)
  137. m.write("*")
  138. sPos = sPos+1
  139. elseif xPos > 3 and xPos < 5 and yPos == 8 then
  140. table.insert(inp,7)
  141. m.setCursorPos(sPos,4)
  142. m.write("*")
  143. sPos = sPos+1
  144. elseif xPos > 7 and xPos < 9 and yPos == 8 then
  145. table.insert(inp,8)
  146. m.setCursorPos(sPos,4)
  147. m.write("*")
  148. sPos = sPos+1
  149. elseif xPos > 11 and xPos < 13 and yPos == 8 then
  150. table.insert(inp,9)
  151. m.setCursorPos(sPos,4)
  152. m.write("*")
  153. sPos = sPos+1
  154. elseif xPos > 3 and xPos < 5 and yPos == 9 then
  155. inp = {}
  156. m.setCursorPos(3,4)
  157. m.write(" ")
  158. sPos = 4
  159. elseif xPos > 7 and xPos < 9 and yPos == 9 then
  160. table.insert(inp,0)
  161. m.setCursorPos(sPos,4)
  162. m.write("*")
  163. sPos = sPos+1
  164. elseif xPos > 11 and xPos < 13 and yPos == 9 then
  165. checkInp()
  166. end
  167. end
  168. end
  169. end
  170.  
  171. input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement