Advertisement
arviwed0310

Code door

Dec 5th, 2015
3,276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    
  2. --      ###### Nur Bitte diese vier Werte bearbeiten! ######
  3. --
  4. --
  5. --
  6. -- Hier bitte Passwort eingeben (4 Ziffern lang)
  7. passwort = "1253"
  8. --
  9. -- Redstone ausgang(bottom,top,back,front,left,right)
  10. redout = "bottom"
  11. --
  12. -- Monitor seite(bottom,top,back,front,left,right)
  13. moniside = "back"
  14. --
  15. -- Super Admin pass: wird gebraucht um das Programm zu beenden!
  16. adminpass = "5555"
  17. --
  18. -- Orginal von ReduceTheBlock
  19. -- Abgeschrieben von Maik Zimmermann
  20. -- Für euch verändert von TobsA13
  21. --
  22. --
  23. -- ### Ab hier bitte nix mehr machen außer du weißt was du machst! ###
  24.  
  25. count = 0
  26. a = 0
  27. b = 0
  28. c = 0
  29. d = 0
  30. eingabe = 0
  31. zugang = 0
  32. term = peripheral.wrap(moniside)
  33. local pullEvent = os.pullEvent
  34. os.pullEvent = os.pullEventRaw
  35. os.setComputerLabel("Passwort-Door" )
  36.  
  37. function Rahmen()
  38. term.clear()
  39. term.setTextColor(colors.white)
  40. term.setCursorPos(2,1)
  41. term.setBackgroundColor(colors.green)
  42. term.write("1")
  43. term.setBackgroundColor(colors.black)
  44. term.write (" ")
  45. term.setBackgroundColor(colors.green)
  46. term.write("2")
  47. term.setBackgroundColor(colors.black)
  48. term.write (" ")
  49. term.setBackgroundColor(colors.green)
  50. term.write("3")
  51. term.setBackgroundColor(colors.black)
  52. term.setCursorPos(2,3)
  53. term.setBackgroundColor(colors.green)
  54. term.write("4")
  55. term.setBackgroundColor(colors.black)
  56. term.write (" ")
  57. term.setBackgroundColor(colors.green)
  58. term.write("5")
  59. term.setBackgroundColor(colors.black)
  60. term.write (" ")
  61. term.setBackgroundColor(colors.green)
  62. term.write("6")
  63. term.setBackgroundColor(colors.black)
  64. term.setCursorPos(2,5)
  65. term.setBackgroundColor(colors.green)
  66. term.write("7")
  67. term.setBackgroundColor(colors.black)
  68. term.write (" ")
  69. term.setBackgroundColor(colors.green)
  70. term.write("8")
  71. term.setBackgroundColor(colors.black)
  72. term.write (" ")
  73. term.setBackgroundColor(colors.green)
  74. term.write("9")
  75. term.setBackgroundColor(colors.black)
  76. end
  77.  
  78.  
  79. function Eingabe()
  80. while count < 4 do
  81. event,side,x,y = os.pullEvent()
  82.  if event == "terminate" then
  83.  write("Admin Passwort:")
  84.  admin = read("*")
  85.  if admin == adminpass then
  86.  os.pullEvent = pullEvent
  87.  write("Richtig! Mache jetzt nochmal STRG + T für 4 sec")
  88.  sleep(5)
  89.  end
  90.  end
  91.  if event == "monitor_touch" then
  92.  
  93.   if x == 2 and y == 1 then
  94.    count = count + 1
  95.    if count == 1 then
  96.    a = 1
  97.    term.setBackgroundColor(colors.black)
  98.    punkt()
  99.    elseif count == 2 then
  100.    b = 1
  101.    punkt()
  102.    elseif count == 3 then
  103.    c = 1
  104.    punkt()
  105.    elseif count == 4 then
  106.    d = 1
  107.    punkt()
  108.    end
  109.   end
  110.  
  111.   if x == 4 and y == 1 then
  112.    count = count + 1
  113.    if count == 1 then
  114.    a = 2
  115.    term.setBackgroundColor(colors.black)
  116.    punkt()
  117.    elseif count == 2 then
  118.    b = 2
  119.    punkt()
  120.    elseif count == 3 then
  121.    c = 2
  122.    punkt()
  123.    elseif count == 4 then
  124.    d = 2
  125.    punkt()
  126.    end
  127.   end
  128.  
  129.   if x == 6 and y == 1 then
  130.    count = count + 1
  131.    if count == 1 then
  132.    a = 3
  133.    term.setBackgroundColor(colors.black)
  134.    punkt()
  135.    elseif count == 2 then
  136.    b = 3
  137.    punkt()
  138.    elseif count == 3 then
  139.    c = 3
  140.    punkt()
  141.    elseif count == 4 then
  142.    d = 3
  143.    punkt()
  144.    end
  145.   end
  146.  
  147.   if x == 2 and y == 3 then
  148.    count = count + 1
  149.    if count == 1 then
  150.    a = 4
  151.    term.setBackgroundColor(colors.black)
  152.    punkt()
  153.    elseif count == 2 then
  154.    b = 4
  155.    punkt()
  156.    elseif count == 3 then
  157.    c = 4
  158.    punkt()
  159.    elseif count == 4 then
  160.    d = 4
  161.    punkt()
  162.    end
  163.   end
  164.  
  165.   if x == 4 and y == 3 then
  166.    count = count + 1
  167.    if count == 1 then
  168.    a = 5
  169.    term.setBackgroundColor(colors.black)
  170.    punkt()
  171.    elseif count == 2 then
  172.    b = 5
  173.    punkt()
  174.    elseif count == 3 then
  175.    c = 5
  176.    punkt()
  177.    elseif count == 4 then
  178.    d = 5
  179.    punkt()
  180.    end
  181.   end
  182.  
  183.   if x == 6 and y == 3 then
  184.    count = count + 1
  185.    if count == 1 then
  186.    a = 6
  187.    term.setBackgroundColor(colors.black)
  188.    punkt()
  189.    elseif count == 2 then
  190.    b = 6
  191.    punkt()
  192.    elseif count == 3 then
  193.    c = 6
  194.    punkt()
  195.    elseif count == 4 then
  196.    d = 6
  197.    punkt()
  198.    end
  199.   end
  200.  
  201.   if x == 2 and y == 5 then
  202.    count = count + 1
  203.    if count == 1 then
  204.    a = 7
  205.    term.setBackgroundColor(colors.black)
  206.    punkt()
  207.    elseif count == 2 then
  208.    b = 7
  209.    punkt()
  210.    elseif count == 3 then
  211.    c = 7
  212.    punkt()
  213.    elseif count == 4 then
  214.    d = 7
  215.    punkt()
  216.    end
  217.   end
  218.  
  219.   if x == 4 and y == 5 then
  220.    count = count + 1
  221.    if count == 1 then
  222.    a = 8
  223.    term.setBackgroundColor(colors.black)
  224.    punkt()
  225.    elseif count == 2 then
  226.    b = 8
  227.    punkt()
  228.    elseif count == 3 then
  229.    c = 8
  230.    punkt()
  231.    elseif count == 4 then
  232.    d = 8
  233.    punkt()
  234.    end
  235.   end
  236.  
  237.   if x == 6 and y == 5 then
  238.    count = count + 1
  239.    if count == 1 then
  240.    a = 9
  241.    term.setBackgroundColor(colors.black)
  242.    punkt()
  243.    elseif count == 2 then
  244.    b = 9
  245.    punkt()
  246.    elseif count == 3 then
  247.    c = 9
  248.    punkt()
  249.    elseif count == 4 then
  250.    d = 9
  251.    punkt()
  252.    end
  253.   end
  254.  
  255.  end
  256. end
  257. count = 0
  258. end
  259.  
  260. function punkt()
  261. if count == 1 then
  262. term.setCursorPos(1,1)
  263. term.write ("*")
  264. elseif count == 2 then
  265. term.setCursorPos(7,1)
  266. term.write ("*")
  267. elseif count == 3 then
  268. term.setCursorPos(1,5)
  269. term.write ("*")
  270. elseif count == 4 then
  271. term.setCursorPos(7,5)
  272. term.write ("*")
  273. sleep(0.2)
  274. end
  275. end
  276.  
  277.  
  278. while true do
  279. Rahmen()
  280. Eingabe()
  281. eingabe = (""..a..""..b..""..c..""..d.."")
  282. zugang = (passwort-eingabe)
  283. if passwort == eingabe then
  284. term.clear()
  285. term.setCursorPos(4,3)
  286. term.setBackgroundColor(colors.black)
  287. term.setTextColor(colors.green)
  288. term.write ("OK")
  289. rs.setOutput(redout, true)
  290. sleep(2.5)
  291. rs.setOutput(redout, false)
  292. else
  293. term.clear()
  294. term.setCursorPos(1,3)
  295. term.setBackgroundColor(colors.black)
  296. term.setTextColor(colors.red)
  297. term.write("FALSCH!")
  298. sleep (1)
  299. term.clear()
  300. term.setCursorPos(4,3)
  301. term.write("5")
  302. sleep(1)
  303. term.setCursorPos(4,3)
  304. term.write("4")
  305. sleep(1)
  306. term.setCursorPos(4,3)
  307. term.write("3")
  308. sleep(1)
  309. term.setCursorPos(4,3)
  310. term.write("2")
  311. sleep(1)
  312. term.setCursorPos(4,3)
  313. term.write("1")
  314. sleep(1)
  315. end
  316. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement