Advertisement
Guest User

startup

a guest
Jul 8th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. local username = "kylian"
  2. local username2 = "sanne"
  3. local password = "bacon"
  4.  
  5. -- Location
  6.  
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. term.setTextColor(colors.gray)
  10. print("[--Location Unknown--]")
  11.  
  12. -- Username settings
  13.  
  14. term.setCursorPos(1,2)
  15. term.setTextColor(colors.blue)
  16. write("Username: ")
  17. term.setCursorPos(11,2)
  18. term.setTextColor(colors.white)
  19. input = read()
  20. if input == username then
  21.   term.setCursorPos(1,3)
  22. elseif input == username2 then
  23.   term.setCursorPos(1,3)
  24. else
  25.   term.setTextColor(colors.red)
  26.   textutils.slowPrint("Username incorrect")
  27.   sleep(2)
  28.   shell.run("startup")
  29. end
  30.  
  31. -- Password settings  
  32.  
  33. term.setTextColor(colors.blue)
  34. write("Password: ")
  35. term.setCursorPos(11,3)
  36. term.setTextColor(colors.white)
  37. input = read("*")
  38. if input == password then
  39.   term.setCursorPos(19,4)
  40.   term.setTextColor(colors.green)
  41.   textutils.slowPrint("Acces granted")
  42.   rs.setOutput("left", true)
  43.   sleep(5)
  44.   rs.setOutput("left", false)
  45.   os.reboot()
  46. else
  47.   term.setCursorPos(19,4)
  48.   term.setTextColor(colors.red)
  49.   textutils.slowPrint("Access Denied!")
  50.   sleep(2)
  51.   shell.run("startup")
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement