Advertisement
Guest User

startup

a guest
May 25th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. local side = "back"
  2.  
  3. local opentime = 5
  4.  
  5. os.pullEvent = os.pullEventRaw -- Prevents CTRL+T shortcut
  6.  
  7. term.clear() -- Clears the screen
  8. term.setCursorPos(1, 1) -- The places the print position to the top of screen
  9.  
  10. username = {"Tody", "Detona", "Poteto", "zirkin", "Francisco"}  -- Here you need to define all usernames avaible
  11. password = {"ABCD", "EUSOMITO", "LOL", "z0k2n7", "2203"}  -- Here you define what password each user has, remember to put user1's password in the first row and so on.
  12.  
  13. monitor = peripheral.wrap("right")
  14. monitor.setTextScale(1)
  15. monitor.setBackgroundColor(colors.blue)
  16. monitor.clear()
  17.  
  18.  monitor.setCursorPos(1, 1)
  19.  monitor.setTextColor(colors.green)
  20.  monitor.write("Login: ")
  21. user = read()
  22.  
  23.   monitor.setCursorPos(1, 2)
  24.   monitor.setTextColor(colors.green)
  25.   monitor.write("Senha: ")
  26. pass = read('*') -- This prevents people from reading the password as you put it in
  27. for i=1, #username do -- Starts a loop
  28.  if user == username[i] and pass == password[i] then
  29.    access = true
  30.  end
  31. end
  32.  
  33. if access == true then
  34.   monitor.setCursorPos(1, 3)
  35.   monitor.setTextColor(colors.red)
  36.   monitor.write("Logando...")
  37. sleep(1)
  38.    monitor.setCursorPos(1, 4)
  39.    monitor.setTextColor(colors.red)
  40.    monitor.write("Bem vindo a ilha "..user)
  41. rs.setOutput(side,true)
  42. sleep(opentime)
  43. rs.setOutput(side,false)
  44. os.reboot()
  45. else
  46.    monitor.setCursorPos(1,3)
  47.    monitor.setTextColor(colors.red)
  48.    monitor.write("Username e senha incorreta")
  49. sleep(2)
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement