Guest User

startup

a guest
Feb 20th, 2017
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.49 KB | None | 0 0
  1. --  ###### Touchpad version 0.1 by JUMBONET! ######
  2. --
  3. --
  4. --
  5. -- Put the password here (4 Numbers max)
  6. passwort = "8535"
  7. --
  8. -- Redstone Output(bottom,top,back,front,left,right)
  9. redout = "left"
  10. --
  11. -- Monitor Side(bottom,top,back,front,left,right)
  12. moniside = "top"
  13. --
  14. -- Super Admin pass: Sexy things xd
  15. adminpass = "TGPV123123"
  16. --
  17. -- Tastenfarbe:
  18. tastencol = 0x800
  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. count = 0
  38. a = 0
  39. b = 0
  40. c = 0
  41. d = 0
  42. eingabe = 0
  43. zugang = 0
  44. term = peripheral.wrap(moniside)
  45. local pullEvent = os.pullEvent
  46. os.pullEvent = os.pullEventRaw
  47. term.setBackgroundColor(colors.black)
  48. if os.getComputerLabel() == nil then
  49. os.setComputerLabel("Password-Door" )
  50. end
  51.  
  52. function Rahmen()
  53. term.clear()
  54. term.setTextColor(colors.white)
  55. term.setCursorPos(2,1)
  56. term.setBackgroundColor(tastencol)
  57. term.write(" 1 ")
  58. term.setBackgroundColor(colors.black)
  59. term.write (" ")
  60. term.setBackgroundColor(tastencol)
  61. term.write(" 2 ")
  62. term.setBackgroundColor(colors.black)
  63. term.write (" ")
  64. term.setBackgroundColor(tastencol)
  65. term.write(" 3 ")
  66. term.setBackgroundColor(colors.black)
  67. term.setCursorPos(2,3)
  68. term.setBackgroundColor(tastencol)
  69. term.write(" 4 ")
  70. term.setBackgroundColor(colors.black)
  71. term.write (" ")
  72. term.setBackgroundColor(tastencol)
  73. term.write(" 5 ")
  74. term.setBackgroundColor(colors.black)
  75. term.write (" ")
  76. term.setBackgroundColor(tastencol)
  77. term.write(" 6 ")
  78. term.setBackgroundColor(colors.black)
  79. term.write ("  ")
  80. term.setBackgroundColor(tastencol)
  81. term.write(" C ")
  82. term.setBackgroundColor(colors.black)
  83. term.setCursorPos(2,5)
  84. term.setBackgroundColor(tastencol)
  85. term.write(" 7 ")
  86. term.setBackgroundColor(colors.black)
  87. term.write (" ")
  88. term.setBackgroundColor(tastencol)
  89. term.write(" 8 ")
  90. term.setBackgroundColor(colors.black)
  91. term.write (" ")
  92. term.setBackgroundColor(tastencol)
  93. term.write(" 9 ")
  94. term.setBackgroundColor(colors.black)
  95. term.setCursorPos(15,2)
  96. term.setBackgroundColor(tastencol)
  97. term.write("   ")
  98. term.setCursorPos(15,4)
  99. term.write("   ")
  100. term.setBackgroundColor(colors.black)
  101. end
  102.  
  103.  
  104. function Eingabe()
  105. while count < 4 do
  106. event,side,x,y = os.pullEvent()
  107.  if event == "terminate" then
  108.  write("Admin Password:")
  109.  admin = read("*")
  110.  if admin == adminpass then
  111.  os.pullEvent = pullEvent
  112.  shell.run("clear")
  113.  shell.run("shell")
  114.  os.reboot()
  115.  sleep(6)
  116.  else
  117.  print("wrong")
  118.  end
  119.  end
  120.  if event == "monitor_touch" then
  121.  
  122.   if (x >= 2 and x<= 4) and y == 1 then
  123.    count = count + 1
  124.    if count == 1 then
  125.    a = 1
  126.    term.setBackgroundColor(colors.black)
  127.    punkt()
  128.    elseif count == 2 then
  129.    b = 1
  130.    punkt()
  131.    elseif count == 3 then
  132.    c = 1
  133.    punkt()
  134.    elseif count == 4 then
  135.    d = 1
  136.    punkt()
  137.    end
  138.   end
  139.  
  140.   if (x >= 6 and x<= 8) and y == 1 then
  141.    count = count + 1/re
  142.    if count == 1 then
  143.    a = 2
  144.    term.setBackgroundColor(colors.black)
  145.    punkt()
  146.    elseif count == 2 then
  147.    b = 2
  148.    punkt()
  149.    elseif count == 3 then
  150.    c = 2
  151.    punkt()
  152.    elseif count == 4 then
  153.    d = 2
  154.    punkt()
  155.    end
  156.   end
  157.  
  158.   if (x >= 10 and x<= 12) and y == 1 then
  159.    count = count + 1
  160.    if count == 1 then
  161.    a = 3
  162.    term.setBackgroundColor(colors.black)
  163.    punkt()
  164.    elseif count == 2 then
  165.    b = 3
  166.    punkt()
  167.    elseif count == 3 then
  168.    c = 3
  169.    punkt()
  170.    elseif count == 4 then
  171.    d = 3
  172.    punkt()
  173.    end
  174.   end
  175.  
  176.   if (x >= 2 and x<= 4) and y == 3 then
  177.    count = count + 1
  178.    if count == 1 then
  179.    a = 4
  180.    term.setBackgroundColor(colors.black)
  181.    punkt()
  182.    elseif count == 2 then
  183.    b = 4
  184.    punkt()
  185.    elseif count == 3 then
  186.    c = 4
  187.    punkt()
  188.    elseif count == 4 then
  189.    d = 4
  190.    punkt()
  191.    end
  192.   end
  193.  
  194.   if (x >= 6 and x<= 8) and y == 3 then
  195.    count = count + 1
  196.    if count == 1 then
  197.    a = 5
  198.    term.setBackgroundColor(colors.black)
  199.    punkt()
  200.    elseif count == 2 then
  201.    b = 5
  202.    punkt()
  203.    elseif count == 3 then
  204.    c = 5
  205.    punkt()
  206.    elseif count == 4 then
  207.    d = 5
  208.    punkt()
  209.    end
  210.   end
  211.  
  212.   if (x >= 10 and x<= 12) and y == 3 then
  213.    count = count + 1
  214.    if count == 1 then
  215.    a = 6
  216.    term.setBackgroundColor(colors.black)
  217.    punkt()
  218.    elseif count == 2 then
  219.    b = 6
  220.    punkt()
  221.    elseif count == 3 then
  222.    c = 6
  223.    punkt()
  224.    elseif count == 4 then
  225.    d = 6
  226.    punkt()
  227.    end
  228.   end
  229.  
  230.   if (x >= 2 and x<= 4) and y == 5 then
  231.    count = count + 1
  232.    if count == 1 then
  233.    a = 7
  234.    term.setBackgroundColor(colors.black)
  235.    punkt()
  236.    elseif count == 2 then
  237.    b = 7
  238.    punkt()
  239.    elseif count == 3 then
  240.    c = 7
  241.    punkt()
  242.    elseif count == 4 then
  243.    d = 7
  244.    punkt()
  245.    end
  246.   end
  247.  
  248.   if (x >= 6 and x<= 8) and y == 5 then
  249.    count = count + 1
  250.    if count == 1 then
  251.    a = 8
  252.    term.setBackgroundColor(colors.black)
  253.    punkt()
  254.    elseif count == 2 then
  255.    b = 8
  256.    punkt()
  257.    elseif count == 3 then
  258.    c = 8
  259.    punkt()
  260.    elseif count == 4 then
  261.    d = 8
  262.    punkt()
  263.    end
  264.   end
  265.  
  266.   if (x >= 10 and x<= 12) and y == 5 then
  267.    count = count + 1
  268.    if count == 1 then
  269.    a = 9
  270.    term.setBackgroundColor(colors.black)
  271.    punkt()
  272.    elseif count == 2 then
  273.    b = 9
  274.    punkt()
  275.    elseif count == 3 then
  276.    c = 9
  277.    punkt()
  278.    elseif count == 4 then
  279.    d = 9
  280.    punkt()
  281.    end
  282.   end
  283.   if (x >= 15 and x<= 17) and (y >= 2 and y<= 5) then
  284.   term.setCursorPos(15,5)
  285.   term.write("    ")
  286.   count = 0
  287.   end
  288.  end
  289. end
  290. count = 0
  291. end
  292.  
  293. function punkt()
  294. if count == 1 then
  295. term.setCursorPos(15,5)
  296. term.write ("*")
  297. elseif count == 2 then
  298. term.setCursorPos(16,5)
  299. term.write ("*")
  300. elseif count == 3 then
  301. term.setCursorPos(17,5)
  302. term.write ("*")
  303. elseif count == 4 then
  304. term.setCursorPos(18,5)
  305. term.write ("*")
  306. sleep(0.1)
  307. end
  308. end
  309.  
  310. function rand()
  311. term.setBackgroundColor(farbe)
  312. term.setCursorPos(1,1)
  313. term.write("                  ")
  314. term.setCursorPos(1,2)
  315. term.write(" ")
  316. term.setCursorPos(18,2)
  317. term.write(" ")
  318. term.setBackgroundColor(colors.black)
  319. term.write(" ")
  320. term.setBackgroundColor(farbe)
  321. term.setCursorPos(1,3)
  322. term.write(" ")
  323. term.setCursorPos(18,3)
  324. term.write(" ")
  325. term.setBackgroundColor(colors.black)
  326. term.write(" ")
  327. term.setBackgroundColor(farbe)
  328. term.setCursorPos(1,4)
  329. term.write(" ")
  330. term.setCursorPos(18,4)
  331. term.write(" ")
  332. term.setBackgroundColor(colors.black)
  333. term.write(" ")
  334. term.setBackgroundColor(farbe)
  335. term.setCursorPos(1,5)
  336. term.write("                  ")
  337. term.setBackgroundColor(colors.black)
  338. end
  339.  
  340.  
  341. while true do
  342. Rahmen()
  343. Eingabe()
  344. eingabe = (""..a..""..b..""..c..""..d.."")
  345. zugang = (passwort-eingabe)
  346. if passwort == eingabe then
  347. term.clear()
  348. term.setBackgroundColor(colors.black)
  349. term.setTextColor(colors.lime)
  350. farbe = 8192
  351. rand()
  352. term.setCursorPos(9,3)
  353. term.write ("OK")
  354. rs.setOutput(redout, true)
  355. sleep(2.5)
  356. rs.setOutput(redout, false)
  357. os.reboot()
  358. else
  359. term.clear()
  360. term.setBackgroundColor(colors.black)
  361. term.setTextColor(colors.red)
  362. farbe = 16384
  363. rand()
  364. term.setCursorPos(8,3)
  365. term.write("NOPE")
  366. sleep (1)
  367. term.setCursorPos(6,3)
  368. term.write("       ")
  369. term.setCursorPos(9,3)
  370. term.write("05")
  371. sleep(1)
  372. term.setCursorPos(9,3)
  373. term.write("04")
  374. sleep(1)
  375. term.setCursorPos(9,3)
  376. term.write("03")
  377. sleep(1)
  378. term.setCursorPos(9,3)
  379. term.write("02")
  380. sleep(1)
  381. term.setCursorPos(9,3)
  382. term.write("01")
  383. sleep(1)
  384. term.setCursorPos(9,3)
  385. term.write("00")
  386. sleep(1)
  387. os.reboot()
  388. end
  389. end
Advertisement
Add Comment
Please, Sign In to add comment