Advertisement
Just1n2802

CC Login Phone

Dec 19th, 2020
1,012
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. -- Stop Termination
  2.  
  3. os.pullEvent = os.pullEventRaw
  4.  
  5. -- Clear Screen
  6.  
  7. term.clear()
  8.  
  9. -- Set Cursor Pos
  10.  
  11. term.setCursorPos(1,1)
  12.  
  13. -- Set Login Info
  14.  
  15. username = {"user1", "user2"} -- adds available usernames
  16. password = {"pass1", "pass2"} -- sets passwords to those usernames
  17.  
  18. -- Enter Info
  19. term.setCursorPos(5,10)
  20. print("Password: ")
  21. term.setCursorPos(5,9)
  22. write("Username: ")
  23. user = read()
  24. term.setCursorPos(5,10)
  25. write("Password: ")
  26. pass = read('*')
  27.  
  28. -- Give/Restrict Access
  29.  
  30. for i = 1, #username do
  31.   if user == username[i] and pass == password[i] then
  32.     access = true
  33.   end
  34. end
  35.  
  36. -- Animation
  37.  
  38. if access == true then
  39.   term.clear()
  40.   term.setCursorPos(8,10)
  41.   print("Logging in...")
  42.   sleep(1)
  43.   term.clear()
  44.   term.setCursorPos(1,1)
  45.   textutils.slowPrint("Welcome "..user)
  46. else
  47.   term.clear()
  48.   term.setCursorPos(9,10)
  49.   textutils.slowPrint("Incorrect.")
  50.   sleep(2)
  51.   os.reboot()
  52. end
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement