Advertisement
Atomosie

Login Program for Computercraft

Feb 19th, 2016
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. -- Login System
  2. -- Written by Brainless243
  3. -- Posted to The Tekkit Wiki on 10/24/2012
  4.  
  5. -- Edited by Marumaru352
  6.  
  7. os.pullEvent = os.pullEventRaw -- Prevents CTRL+T shortcut
  8.  
  9. term.clear() -- Clears the screen
  10. term.setCursorPos(1, 1) -- This places the print position to the top of screen
  11.  
  12. username = {"Atomosie", "DwarvenKings", "TheBrotherHood"}  -- Here you need to define all usernames available
  13. password = {"derp101", "dwarves", "cooldudes"}  -- Here you define what password each user has, remember to put user1's password in the first row and so on.
  14.  
  15. write("Username: ")
  16. user = read()
  17.  
  18. write("Password: ")
  19. pass = read('*') -- This prevents people from reading the password as you put it in
  20.  
  21. for i=1, #username do -- Starts a loop
  22.  if user == username[i] and pass == password[i] then
  23.    access = true
  24.  end
  25. end
  26.  
  27. if access == true then
  28. print("Logging in...")
  29. sleep(1)
  30. print("Welcome "..user)
  31. else
  32. print("Incorrect username and password combination")
  33. sleep(2)
  34. os.reboot()
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement