Marlingaming

Login

Dec 6th, 2021 (edited)
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. --this is a Login Script
  2. version = "1.0.3"
  3. local Account = 0
  4. local Password = 0
  5.  
  6. local function Clear()
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. end
  10.  
  11. local function LoginMenu()
  12. Clear()
  13. print("Enter Username, then press Enter")
  14. repeat
  15. local event, key = os.pullEvent("key")
  16. local input = read()
  17. until key == keys.enter
  18. Account = Input
  19. print("Enter Password, then press enter")
  20. repeat
  21. local event, key = os.pullEvent("key")
  22. local input = read()
  23. until key == keys.enter
  24. local Password = input
  25. print("Searching for Account")
  26. if fs.exists(Account) == true then
  27. local File = fs.open(Account,"r")
  28. if File.readLine() == Password then
  29. File.close()
  30. Signin()
  31. else
  32. File.close()
  33. os.sleep(3)
  34. os.reboot()
  35. end
  36. else
  37. print("Account does not exist")
  38. os.sleep(3)
  39. os.reboot()
  40. end
  41. end
  42.  
  43. local function Signin()
  44. shell.run("AccountManager",Account)
  45. end
  46.  
  47. local function CreateAccount()
  48. Clear()
  49. print("Create Account")
  50. print("Enter Username")
  51. repeat
  52. local event,key = os.pullEvent("key")
  53. local input = read()
  54. until key == keys.enter
  55. Account = input
  56. print("Enter Password")
  57. repeat
  58. local event, key = os.pullEvent("key")
  59. local input = read()
  60. until key == keys.enter
  61. Password = input
  62. print("Creating Account")
  63. local File = fs.open(Account,"w")
  64. File.writeLine(Password)
  65. File.writeLine(0)
  66. File.close()
  67. print("Account Created, Logging in")
  68. shell.run("AccountManager",Account)
  69. end
  70.  
  71. Clear()
  72. print("BANKING TERMINAL-- Version = "..version)
  73. print("Options")
  74. print("1 - Login")
  75. print("2 - Create Account")
  76. repeat
  77. local event, key = os.pullEvent("key")
  78. until key == keys.one or key == keys.two
  79. if key == keys.one then
  80. LoginMenu()
  81. elseif key == keys.two then
  82. CreateAccount()
  83. end
  84.  
  85.  
  86. Clear()
Advertisement
Add Comment
Please, Sign In to add comment