Advertisement
ignzio

Untitled

Mar 26th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 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"
  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("Tech Lab os"..version, 1)
  20. printCentered(" by: Clothespin Fox", 2)
  21. end
  22. local function uCheck()
  23. write("Username: ")
  24. uInput = read()
  25. if uInput == user then
  26. uAllow = true
  27. else
  28. print("Username Sbagliato!")
  29. sleep(2)
  30. os.reboot()
  31. end
  32. end
  33. local function pCheck()
  34. write("Password: ")
  35. pInput = read("*")
  36. if pInput == pass then
  37. pAllow = true
  38. else
  39. print("Password Sbagliata!")
  40. sleep(2)
  41. os.reboot()
  42. end
  43. end
  44. --Main Program
  45. clear()
  46. printHeader()
  47. term.setCursorPos(1,4)
  48. uCheck()
  49. if uAllow == true then
  50. term.setCursorPos(1,5)
  51. pCheck()
  52. end
  53. if uAllow == true and pAllow == true then
  54. textutils.slowPrint("Loggo . . . . . .")
  55. sleep(5)
  56. clear()
  57. print("Loggato con successo!")
  58. print("Ora puoi usare il computer!")
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement