Advertisement
Andreas_0690

Password System 2.0 [MC CC]

Jun 17th, 2016
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.48 KB | None | 0 0
  1. -- Variables
  2. local debug = 3
  3. local slang = 1.5
  4. local snorm = 0.7
  5. local skurz = 0.5
  6. local passwort = "adm-sup"
  7. local username = "Admteam"
  8. local color_white = 1
  9. local color_orange = 2
  10. local color_lgreen = 32
  11. local color_grey = 128
  12. local color_green = 8192
  13. local color_red = 16384
  14. local color_black = 32768
  15. tries = 3
  16.  
  17. os.pullEvent = os.pullEventRaw
  18. PW_Anzeige1 = function()
  19. shell.run ("clear")
  20. term.setTextColor(color_green)
  21. term.setCursorPos (11, 2) print "------------------------------"
  22. term.setCursorPos (11, 4) print "------------------------------"
  23. sleep (skurz)
  24. term.setTextColor(color_green)
  25. term.setCursorPos (15, 3) textutils.slowPrint "Administrations Login"
  26. sleep (snorm)
  27. term.setBackgroundColor(color_black)
  28. term.setTextColor(color_green)
  29. term.setCursorPos (15, 9) print "Username:"
  30. term.setCursorPos (15,11) print "Passwort:"
  31. PW_Anzeige2 ()
  32. end
  33. PW_Anzeige2 = function()
  34. term.setBackgroundColor(color_green)
  35. term.setTextColor(color_black)
  36. term.setCursorPos (25, 9) print "          "
  37. term.setCursorPos (25,11) print "          "
  38. PW_Abfrage ()
  39. end
  40. PW_Abfrage = function()
  41. sleep (skurz)
  42. term.setCursorPos (26, 9) user = read()
  43. term.setCursorPos (26,11) pw = read("*")
  44.     if pw == passwort and user == username then
  45.         sleep (snorm)
  46.         shell.run ("/os/cmd_new")
  47.     else
  48.         tries = tries -1
  49.         if tries >= 1 then
  50.         term.setBackgroundColor(color_black)
  51.         term.setTextColor(color_green)
  52.         term.setCursorPos (15, 8) print "-----------------------"
  53.         term.setCursorPos (14, 9) print "|                       |"
  54.         term.setCursorPos (14,10) print "|    |!| Error |!|      |"
  55.         term.setCursorPos (14,11) print "|                       |"
  56.         term.setCursorPos (15,12) print "-----------------------"
  57.         sleep (skurz)
  58.             if tries > 1 then
  59.                 term.setCursorPos (14,3) write "Sie haben noch " write(tries) write " Versuche."
  60.                 sleep (slang)
  61.                 PW_Anzeige1 ()
  62.             else
  63.                 term.setCursorPos (14,3) write "Sie haben noch " write(tries) write " Versuch."
  64.                 sleep (slang)
  65.                 PW_Anzeige1 ()
  66.             end
  67.         else
  68.             term.setBackgroundColor(color_black)
  69.             term.setTextColor(color_green)
  70.             term.setCursorPos (13, 8) print "--------------------------"
  71.             term.setCursorPos (13, 9) print "                          "
  72.             term.setCursorPos (13,10) print "|!| Zugriff verweigert |!|"
  73.             term.setCursorPos (13,11) print "                          "
  74.             term.setCursorPos (13,12) print "--------------------------"
  75.             sleep (slang)
  76.             shell.run ("/os/main_new")
  77.         end
  78.     end
  79. end
  80. PW_Anzeige1 ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement