Advertisement
Guest User

Untitled

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