Advertisement
Guest User

PIN 1.0

a guest
Feb 8th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.74 KB | None | 0 0
  1. passwort = 1234
  2. count = 0
  3. bla = 0
  4. new = bla+0
  5. setPW = bla+0
  6. a = 0
  7. b = 0
  8. c = 0
  9. d = 0
  10. eingabe = 0
  11. zugang = 0
  12.  
  13. function Rahmen()
  14. shell.run("clear")
  15. term.setTextColour(colors.white)
  16. term.setBackgroundColor(colors.green)
  17. term.setCursorPos(2,2)
  18. print("1 2 3")
  19. term.setCursorPos(2,3)
  20. print("4 5 6")
  21. term.setCursorPos(2,4)
  22. print("7 8 9")
  23. if setNew == 0 then
  24. term.setBackgroundColor(colors.red)
  25. term.setCursorPos(6,5)
  26. print("X")
  27. end
  28. end
  29.  
  30. term.setBackgroundColor(colors.black)
  31.  
  32. function Eingabe()
  33. while count < 4 do
  34. event,side,x,y = os.pullEvent()
  35.   if event == "monitor_touch" then
  36.  
  37.       if x == 3 and y == 2 then
  38.        count = count + 1
  39.        if count == 1 then
  40.        a = 1
  41.        term.setBackgroundColor(colors.black)
  42.        write("*")
  43.        elseif count == 2 then
  44.        b = 1
  45.        write("*")
  46.        elseif count == 3 then
  47.        c = 1
  48.        write("*")
  49.        elseif count == 4 then
  50.        d = 1
  51.        write("*")
  52.        end
  53.       end
  54.      
  55.       if x == 5 and y == 2 then
  56.       count = count + 1
  57.       if count == 1 then
  58.       a = 2
  59.       term.setBackgroundColor(colors.black)
  60.       write("*")
  61.       elseif count == 2 then
  62.       b = 2
  63.       write("*")
  64.       elseif count == 3 then
  65.       c = 2
  66.       write("*")
  67.       elseif count == 4 then
  68.       d = 2
  69.       write("*")
  70.       end
  71.       end
  72.      
  73.       if x == 7 and y == 2 then
  74.       count = count + 1
  75.       if count == 1 then
  76.       a = 3
  77.       term.setBackgroundColor(colors.black)
  78.       write("*")
  79.       elseif count == 2 then
  80.       b = 3
  81.       write("*")
  82.       elseif count == 3 then
  83.       c = 3
  84.       write("*")
  85.       elseif count == 4 then
  86.       d = 3
  87.       write("*")
  88.       end
  89.       end
  90.      
  91.       if x == 3 and y == 3 then
  92.       count = count + 1
  93.       if count == 1 then
  94.       a = 4
  95.       term.setBackgroundColor(colors.black)
  96.       write("*")
  97.       elseif count == 2 then
  98.       b = 4
  99.       write("*")
  100.       elseif count == 3 then
  101.       c = 4
  102.       write("*")
  103.       elseif count == 4 then
  104.       d = 4
  105.       write("*")
  106.       end
  107.       end
  108.      
  109.       if x == 5 and y == 3 then
  110.       count = count + 1
  111.       if count == 1 then
  112.       a = 5
  113.       term.setBackgroundColor(colors.black)
  114.       write("*")
  115.       elseif count == 2 then
  116.       b = 5
  117.       write("*")
  118.       elseif count == 3 then
  119.       c = 5
  120.       write("*")
  121.       elseif count == 4 then
  122.       d = 5
  123.       write("*")
  124.       end
  125.       end
  126.      
  127.       if x == 7 and y == 3 then
  128.       count = count + 1
  129.       if count == 1 then
  130.       a = 6
  131.       term.setBackgroundColor(colors.black)
  132.       write("*")
  133.       elseif count == 2 then
  134.       b = 6
  135.       write("*")
  136.       elseif count == 3 then
  137.       c = 6
  138.       write("*")
  139.       elseif count == 4 then
  140.       d = 6
  141.       write("*")
  142.       end
  143.       end
  144.      
  145.       if x == 3 and y == 4 then
  146.       count = count + 1
  147.       if count == 1 then
  148.       a = 7
  149.       term.setBackgroundColor(colors.black)
  150.       write("*")
  151.       elseif count == 2 then
  152.       b = 7
  153.       write("*")
  154.       elseif count == 3 then
  155.       c = 7
  156.       write("*")
  157.       elseif count == 4 then
  158.       d = 7
  159.       write("*")
  160.       end
  161.       end
  162.      
  163.       if x == 5 and y == 4 then
  164.       count = count + 1
  165.       if count == 1 then
  166.       a = 8
  167.       term.setBackgroundColor(colors.black)
  168.       write("*")
  169.       elseif count == 2 then
  170.       b = 8
  171.       write("*")
  172.       elseif count == 3 then
  173.       c = 8
  174.       write("*")
  175.       elseif count == 4 then
  176.       d = 8
  177.       write("*")
  178.       end
  179.       end
  180.      
  181.       if x == 7 and y == 4 then
  182.       count = count + 1
  183.       if count == 1 then
  184.       a = 9
  185.       term.setBackgroundColor(colors.black)
  186.       write("*")
  187.       elseif count == 2 then
  188.       b = 9
  189.       write("*")
  190.       elseif count == 3 then
  191.       c = 9
  192.       write("*")
  193.       elseif count == 4 then
  194.       d = 9
  195.       write("*")
  196.       end
  197.       end
  198.      
  199.       if x == 7 and y == 5 then
  200.       new = 1
  201.       end
  202.      
  203. end
  204. end
  205. count = 0
  206. end
  207.  
  208. while true do
  209. Rahmen()
  210. Eingabe()
  211.  
  212. term.clear()
  213. term.setCursorPos(2,2)
  214. eingabe = (""..a..""..b..""..c..""..d.."")
  215. if setNew == 1 then
  216. zugang = passwort
  217.  
  218. else
  219. zugang = (passwort-eingabe)
  220. if zugang == 0 then
  221. if new == 1 then
  222. setNew = 1
  223. new = 0
  224. write("Write")
  225. term.setCursorPos(2,3)
  226. write("down")
  227. term.setCursorPos(2,4)
  228. write("new PW")
  229. term.setCursorPos(2,5)
  230. write("now!")
  231. sleep(3.5)
  232. else
  233. term.setTextColour(colors.green)
  234. write("Access")
  235. term.setCursorPos(2,3)
  236. write("granted")
  237. rs.setOutput("bottom", true)
  238. sleep(3,5)
  239. rs.setOutput("bottom", false)
  240. end
  241. else
  242. term.setTextColour(colors.red)
  243. write("Access")
  244. term.setCursorPos(2,3)
  245. write("denied")
  246. term.setTextColour(colors.white)
  247. end
  248. end
  249.  
  250. sleep(3)
  251. term.setBackgroundColor(colors.black)
  252. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement