Advertisement
Guest User

startup

a guest
Oct 24th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1. local w, h = term.getSize()
  2. local door = true
  3. --Variables
  4. local user = "Minebox260"
  5. local pass = "arfolip40"
  6. local uAllow = false
  7. local pAllow = false
  8. version = "1.3.7"
  9. --Functions
  10. function BGC(color)
  11.   term.setBackgroundColor(color)
  12. end
  13.  
  14. function clear()
  15.   shell.run("clear")
  16. end
  17. function TC(color)
  18.   term.setTextColor(color)
  19. end
  20.  
  21. function printCentered(msg, h)
  22.   term.setCursorPos(w/2 - #msg/2, h)
  23.   write(msg)
  24. end
  25. local function printHeader()
  26.   BGC(512)
  27.   shell.run("clear")
  28.   printCentered("NC Security "..version, 1)
  29.   printCentered("Laboratories Entrance", 2)
  30. end
  31. local function uCheck()
  32.   term.setTextColor(colors.orange)
  33.   write("Username: ")
  34.   uInput = read()
  35.   if uInput == user then
  36.     uAllow = true
  37.   else
  38.     term.setTextColor(colors.red)
  39.     print("Incorrect Username!")
  40.     sleep(2)
  41.     os.reboot()
  42.   end
  43. end
  44. local function pCheck()
  45.   write("Password: ")
  46.   pInput = read("*")
  47.   if pInput == pass then
  48.     pAllow = true
  49.   else
  50.     term.setTextColor(colors.red)
  51.     print("Incorrect Password!")
  52.     sleep(2)
  53.     os.reboot()
  54.   end
  55. end
  56. --Main Program
  57. shell.run("clear")
  58. printHeader()
  59. term.setCursorPos(1,4)
  60. uCheck()
  61. if uAllow == true then
  62.   term.setCursorPos(1,5)
  63.   pCheck()
  64. end
  65. if uAllow == true and pAllow == true then
  66.   term.setTextColor(colors.magenta)
  67.   textutils.slowPrint("Loging in...")
  68.   sleep(2)
  69.   clear()
  70.   term.setTextColor(colors.lime)
  71.   print("Logged in")
  72.   print("Access Granted")
  73.  
  74.  
  75.  
  76.   os.reboot()
  77.  
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement