Advertisement
Guest User

Password Script

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