Advertisement
Guest User

Door

a guest
Sep 1st, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.64 KB | None | 0 0
  1. --  ###### Nur Bitte diese vier Werte bearbeiten! ######
  2. --
  3. --
  4. --
  5. -- Hier bitte Passwort eingeben (4 Ziffern lang)
  6. passwort = "1253"
  7. --
  8. -- Redstone ausgang(bottom,top,back,front,left,right)
  9. redout = "bottom"
  10. --
  11. -- Monitor seite(bottom,top,back,front,left,right)
  12. moniside = "back"
  13. --
  14. -- Super Admin pass: wird gebraucht um das Programm zu beenden!
  15. adminpass = "5555"
  16. --
  17. -- Tastenfarbe:
  18. tastencol = 0x2000
  19. -- Farbcodes:
  20. -- white                0x1
  21. -- orange               0x2
  22. -- magenta              0x4
  23. -- lightBlue            0x8
  24. -- yellow               0x10   
  25. -- lime                 0x20
  26. -- pink                 0x40
  27. -- gray                 0x80
  28. -- lightGray            0x100  
  29. -- cyan                 0x200    
  30. -- purple               0x400
  31. -- blue                 0x800  
  32. -- brown                0x1000
  33. -- green                0x2000
  34. -- red                  0x4000
  35. -- black                0x8000
  36.  
  37. -- Orginal von ReduceTheBlock
  38. -- Abgeschrieben von Maik Zimmermann
  39. -- FåBCr euch veråA4ndert von TobsA13
  40. --
  41. --
  42. -- ### Ab hier bitte nix mehr machen auå9Fer du weiå9Ft was du machst! ###
  43.  
  44. count = 0
  45. a = 0
  46. b = 0
  47. c = 0
  48. d = 0
  49. eingabe = 0
  50. zugang = 0
  51. term = peripheral.wrap(moniside)
  52. local pullEvent = os.pullEvent
  53. os.pullEvent = os.pullEventRaw
  54. term.setBackgroundColor(colors.black)
  55. if os.getComputerLabel() == nil then
  56. os.setComputerLabel("Passwort-Door" )
  57. end
  58.  
  59. function Rahmen()
  60. term.clear()
  61. term.setTextColor(colors.white)
  62. term.setCursorPos(2,1)
  63. term.setBackgroundColor(tastencol)
  64. term.write(" 1 ")
  65. term.setBackgroundColor(colors.black)
  66. term.write (" ")
  67. term.setBackgroundColor(tastencol)
  68. term.write(" 2 ")
  69. term.setBackgroundColor(colors.black)
  70. term.write (" ")
  71. term.setBackgroundColor(tastencol)
  72. term.write(" 3 ")
  73. term.setBackgroundColor(colors.black)
  74. term.setCursorPos(2,3)
  75. term.setBackgroundColor(tastencol)
  76. term.write(" 4 ")
  77. term.setBackgroundColor(colors.black)
  78. term.write (" ")
  79. term.setBackgroundColor(tastencol)
  80. term.write(" 5 ")
  81. term.setBackgroundColor(colors.black)
  82. term.write (" ")
  83. term.setBackgroundColor(tastencol)
  84. term.write(" 6 ")
  85. term.setBackgroundColor(colors.black)
  86. term.write ("  ")
  87. term.setBackgroundColor(tastencol)
  88. term.write(" C ")
  89. term.setBackgroundColor(colors.black)
  90. term.setCursorPos(2,5)
  91. term.setBackgroundColor(tastencol)
  92. term.write(" 7 ")
  93. term.setBackgroundColor(colors.black)
  94. term.write (" ")
  95. term.setBackgroundColor(tastencol)
  96. term.write(" 8 ")
  97. term.setBackgroundColor(colors.black)
  98. term.write (" ")
  99. term.setBackgroundColor(tastencol)
  100. term.write(" 9 ")
  101. term.setBackgroundColor(colors.black)
  102. term.setCursorPos(15,2)
  103. term.setBackgroundColor(tastencol)
  104. term.write("   ")
  105. term.setCursorPos(15,4)
  106. term.write("   ")
  107. term.setBackgroundColor(colors.black)
  108. end
  109.  
  110.  
  111. function Eingabe()
  112. while count < 4 do
  113. event,side,x,y = os.pullEvent()
  114.  if event == "terminate" then
  115.  write("Admin Passwort:")
  116.  admin = read("*")
  117.  if admin == adminpass then
  118.  os.pullEvent = pullEvent
  119.  write("Richtig! Mache jetzt nochmal STRG + T fuer 4 sec. Du hast 6 sec Zeit.")
  120.  sleep(6)
  121.  end
  122.  end
  123.  if event == "monitor_touch" then
  124.  
  125.   if (x >= 2 and x<= 4) and y == 1 then
  126.    count = count + 1
  127.    if count == 1 then
  128.    a = 1
  129.    term.setBackgroundColor(colors.black)
  130.    punkt()
  131.    elseif count == 2 then
  132.    b = 1
  133.    punkt()
  134.    elseif count == 3 then
  135.    c = 1
  136.    punkt()
  137.    elseif count == 4 then
  138.    d = 1
  139.    punkt()
  140.    end
  141.   end
  142.  
  143.   if (x >= 6 and x<= 8) and y == 1 then
  144.    count = count + 1
  145.    if count == 1 then
  146.    a = 2
  147.    term.setBackgroundColor(colors.black)
  148.    punkt()
  149.    elseif count == 2 then
  150.    b = 2
  151.    punkt()
  152.    elseif count == 3 then
  153.    c = 2
  154.    punkt()
  155.    elseif count == 4 then
  156.    d = 2
  157.    punkt()
  158.    end
  159.   end
  160.  
  161.   if (x >= 10 and x<= 12) and y == 1 then
  162.    count = count + 1
  163.    if count == 1 then
  164.    a = 3
  165.    term.setBackgroundColor(colors.black)
  166.    punkt()
  167.    elseif count == 2 then
  168.    b = 3
  169.    punkt()
  170.    elseif count == 3 then
  171.    c = 3
  172.    punkt()
  173.    elseif count == 4 then
  174.    d = 3
  175.    punkt()
  176.    end
  177.   end
  178.  
  179.   if (x >= 2 and x<= 4) and y == 3 then
  180.    count = count + 1
  181.    if count == 1 then
  182.    a = 4
  183.    term.setBackgroundColor(colors.black)
  184.    punkt()
  185.    elseif count == 2 then
  186.    b = 4
  187.    punkt()
  188.    elseif count == 3 then
  189.    c = 4
  190.    punkt()
  191.    elseif count == 4 then
  192.    d = 4
  193.    punkt()
  194.    end
  195.   end
  196.  
  197.   if (x >= 6 and x<= 8) and y == 3 then
  198.    count = count + 1
  199.    if count == 1 then
  200.    a = 5
  201.    term.setBackgroundColor(colors.black)
  202.    punkt()
  203.    elseif count == 2 then
  204.    b = 5
  205.    punkt()
  206.    elseif count == 3 then
  207.    c = 5
  208.    punkt()
  209.    elseif count == 4 then
  210.    d = 5
  211.    punkt()
  212.    end
  213.   end
  214.  
  215.   if (x >= 10 and x<= 12) and y == 3 then
  216.    count = count + 1
  217.    if count == 1 then
  218.    a = 6
  219.    term.setBackgroundColor(colors.black)
  220.    punkt()
  221.    elseif count == 2 then
  222.    b = 6
  223.    punkt()
  224.    elseif count == 3 then
  225.    c = 6
  226.    punkt()
  227.    elseif count == 4 then
  228.    d = 6
  229.    punkt()
  230.    end
  231.   end
  232.  
  233.   if (x >= 2 and x<= 4) and y == 5 then
  234.    count = count + 1
  235.    if count == 1 then
  236.    a = 7
  237.    term.setBackgroundColor(colors.black)
  238.    punkt()
  239.    elseif count == 2 then
  240.    b = 7
  241.    punkt()
  242.    elseif count == 3 then
  243.    c = 7
  244.    punkt()
  245.    elseif count == 4 then
  246.    d = 7
  247.    punkt()
  248.    end
  249.   end
  250.  
  251.   if (x >= 6 and x<= 8) and y == 5 then
  252.    count = count + 1
  253.    if count == 1 then
  254.    a = 8
  255.    term.setBackgroundColor(colors.black)
  256.    punkt()
  257.    elseif count == 2 then
  258.    b = 8
  259.    punkt()
  260.    elseif count == 3 then
  261.    c = 8
  262.    punkt()
  263.    elseif count == 4 then
  264.    d = 8
  265.    punkt()
  266.    end
  267.   end
  268.  
  269.   if (x >= 10 and x<= 12) and y == 5 then
  270.    count = count + 1
  271.    if count == 1 then
  272.    a = 9
  273.    term.setBackgroundColor(colors.black)
  274.    punkt()
  275.    elseif count == 2 then
  276.    b = 9
  277.    punkt()
  278.    elseif count == 3 then
  279.    c = 9
  280.    punkt()
  281.    elseif count == 4 then
  282.    d = 9
  283.    punkt()
  284.    end
  285.   end
  286.   if (x >= 15 and x<= 17) and (y >= 2 and y<= 5) then
  287.   term.setCursorPos(15,5)
  288.   term.write("    ")
  289.   count = 0
  290.   end
  291.  end
  292. end
  293. count = 0
  294. end
  295.  
  296. function punkt()
  297. if count == 1 then
  298. term.setCursorPos(15,5)
  299. term.write ("*")
  300. elseif count == 2 then
  301. term.setCursorPos(16,5)
  302. term.write ("*")
  303. elseif count == 3 then
  304. term.setCursorPos(17,5)
  305. term.write ("*")
  306. elseif count == 4 then
  307. term.setCursorPos(18,5)
  308. term.write ("*")
  309. sleep(0.1)
  310. end
  311. end
  312.  
  313. function rand()
  314. term.setBackgroundColor(farbe)
  315. term.setCursorPos(1,1)
  316. term.write("                  ")
  317. term.setCursorPos(1,2)
  318. term.write(" ")
  319. term.setCursorPos(18,2)
  320. term.write(" ")
  321. term.setBackgroundColor(colors.black)
  322. term.write(" ")
  323. term.setBackgroundColor(farbe)
  324. term.setCursorPos(1,3)
  325. term.write(" ")
  326. term.setCursorPos(18,3)
  327. term.write(" ")
  328. term.setBackgroundColor(colors.black)
  329. term.write(" ")
  330. term.setBackgroundColor(farbe)
  331. term.setCursorPos(1,4)
  332. term.write(" ")
  333. term.setCursorPos(18,4)
  334. term.write(" ")
  335. term.setBackgroundColor(colors.black)
  336. term.write(" ")
  337. term.setBackgroundColor(farbe)
  338. term.setCursorPos(1,5)
  339. term.write("                  ")
  340. term.setBackgroundColor(colors.black)
  341. end
  342.  
  343.  
  344. while true do
  345. Rahmen()
  346. Eingabe()
  347. eingabe = (""..a..""..b..""..c..""..d.."")
  348. zugang = (passwort-eingabe)
  349. if passwort == eingabe then
  350. term.clear()
  351. term.setBackgroundColor(colors.black)
  352. term.setTextColor(tastencol)
  353. farbe = 8192
  354. rand()
  355. term.setCursorPos(9,3)
  356. term.write ("OK")
  357. rs.setOutput(redout, true)
  358. sleep(2.5)
  359. rs.setOutput(redout, false)
  360. else
  361. term.clear()
  362. term.setBackgroundColor(colors.black)
  363. term.setTextColor(colors.red)
  364. farbe = 16384
  365. rand()
  366. term.setCursorPos(7,3)
  367. term.write("FALSCH")
  368. sleep (1)
  369. term.setCursorPos(6,3)
  370. term.write("       ")
  371. term.setCursorPos(9,3)
  372. term.write("5")
  373. sleep(1)
  374. term.setCursorPos(9,3)
  375. term.write("4")
  376. sleep(1)
  377. term.setCursorPos(9,3)
  378. term.write("3")
  379. sleep(1)
  380. term.setCursorPos(9,3)
  381. term.write("2")
  382. sleep(1)
  383. term.setCursorPos(9,3)
  384. term.write("1")
  385. sleep(1)
  386. end
  387. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement