Advertisement
Guest User

.login

a guest
Mar 6th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.65 KB | None | 0 0
  1. --user1
  2. username1 = "cheese3660"
  3. password1 = "alby3660"
  4. --user2
  5. username2 = "macncheesekid"
  6. password2 = "alby3660"
  7. --user3
  8. username3 = "alex"
  9. password3 = "allen"
  10. --user
  11. userN = 1
  12. --functions
  13. function drawMenu(user)
  14. if user == 1 then
  15. term.clear()
  16. term.setCursorPos(1,1)
  17. print("CheeseOS secure login")
  18. print("["..username1.."]")
  19. print(" "..username2.." ")
  20. print(" "..username3.." ")
  21. elseif user == 2 then
  22. term.clear()
  23. term.setCursorPos(1,1)
  24. print("CheeseOS secure login")
  25. print(" "..username1.." ")
  26. print("["..username2.."]")
  27. print(" "..username3.." ")
  28. elseif user == 3 then
  29. term.clear()
  30. term.setCursorPos(1,1)
  31. print("CheeseOS secure login")
  32. print(" "..username1.." ")
  33. print(" "..username2.." ")
  34. print("["..username3.."]")
  35. end
  36. end
  37. drawMenu(userN)
  38. while 1 do
  39. event, key = os.pullEvent("key")
  40. if key == keys.w then
  41. userN = userN-1
  42. if userN == 0 then
  43. userN = 3
  44. end
  45. drawMenu(userN)
  46. elseif key == keys.s then
  47. userN = userN + 1
  48. if userN ==  4 then
  49. userN = 1
  50. end
  51. drawMenu(userN)
  52. elseif key == keys.enter then
  53. break
  54. end
  55. end
  56. function login(user)
  57. if user == 1 then
  58. while 1 do
  59. term.clear()
  60. term.setCursorPos(1,1)
  61. write("password: ")
  62. if read("*") == password1 then
  63. break
  64. end
  65. end
  66. elseif user == 2 then
  67. while 1 do
  68. term.clear()
  69. term.setCursorPos(1,1)
  70. write("password: ")
  71. if read("*") == password2 then
  72. break
  73. end
  74. end
  75. else
  76. while 1 do
  77. term.clear()
  78. term.setCursorPos(1,1)
  79. write("password: ")
  80. if read("*") == password3 then
  81. break
  82. end
  83. end
  84. end
  85. end
  86. login(userN)
  87. term.clear()
  88. term.setCursorPos(1,1)
  89. print("to change username and/or password edit .login")
  90. print("press any key to continue")
  91. os.pullEvent("key")
  92. shell.run("gui")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement