Advertisement
Guest User

Startsoftware

a guest
Jan 30th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. local w, h = term.getSize()
  3. --Variables
  4. local user = "Human"
  5. local pass = "password"
  6. local uAllow = false
  7. local pAllow = false
  8. version = "1.0.0"
  9. --Functions
  10. function clear()
  11. term.clear()
  12. term.setCursorPos(1,1)
  13. end
  14. function printCentered(msg, h)
  15. term.setCursorPos(w/2 - #msg/2, h)
  16. write(msg)
  17. end
  18. local function printHeader()
  19. printCentered("Login System V"..version, 1)
  20. printCentered("Coded by: Human", 2)
  21. end
  22. local function uCheck()
  23. write("Username: ")
  24. uInput = read()
  25. if uInput == user then
  26. uAllow = true
  27. else print("Incorrect Username!")
  28. sleep(2)
  29. os.reboot()
  30. end
  31. end
  32. local function pCheck()
  33. write("Password: ")
  34. pInput = read("*")
  35. if pInput == pass then
  36. pAllow = true
  37. else
  38. print("Incorrect Password!")
  39. sleep(2)
  40. os.reboot()
  41. end
  42. end
  43. --Main Program
  44. clear()
  45. printHeader()
  46. term.setCursorPos(1,4)
  47. uCheck()
  48. if uAllow == true then
  49. term.setCursorPos(1,5)
  50. pCheck()
  51. end
  52. if uAllow == true and pAllow == true then
  53. textutils.slowPrint("Loging in...")
  54. sleep(2)
  55. clear()
  56. print("Logged in")
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement