Advertisement
Duhfff

Untitled

Jul 19th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. -- Cabriolaile's login program v1.0
  2. -- Author: Vortex
  3. -- Program type: Computer, 1.5, security
  4. -- Version: 1.0
  5. -- Language used: Lua
  6. while true do
  7. os.pullEvent = os.pullEventRaw
  8. term.clear()
  9. term.setCursorPos(1,1)
  10. if term.isColor then
  11. term.setTextColor(colors.blue)
  12. end
  13. print("CraftOS Login v1.0 by Vortex")
  14. if term.isColor then
  15. term.setTextColor(colors.white)
  16. end
  17. print("Please identify yourself.")
  18. local user="Steve" -- Replace it with your username
  19. local pass="Password" -- Replace it with your own password.
  20. term.setCursorPos(3,4)
  21. write("Username: ")
  22. term.setCursorPos(3,5)
  23. write("Password: ")
  24. term.setCursorPos(5,7)
  25. write("Username: ")
  26. input=read()
  27. if input == user then
  28. term.setCursorPos(3,4)
  29. term.clearLine()
  30. write("Username: "..user)
  31. term.setCursorPos(5,7)
  32. term.clearLine()
  33. write("Password: ")
  34. input=read("*")
  35. -- input=read()
  36. if input == pass then
  37. term.setCursorPos(3,5)
  38. term.clearLine()
  39. write("Password: [hidden]")
  40. -- write("Password: "..pass)
  41. term.setCursorPos(5,7)
  42. if term.isColor then
  43. term.setTextColor(colors.lime)
  44. end
  45. write("Password correct! Access granted!")
  46. sleep(2)
  47. term.setCursorPos(1,1)
  48. term.clear()
  49. else
  50. term.setCursorPos(3,7)
  51. term.clearLine()
  52. if term.isColor then
  53. term.setTextColor(colors.red)
  54. end
  55. write("Password not correct. Access denied!")
  56. sleep(2)
  57. end
  58. else
  59. term.setCursorPos(5,7)
  60. term.clearLine()
  61. if term.isColor then
  62. term.setTextColor(colors.red)
  63. end
  64. write("User doesn't exist! Access denied!")
  65. sleep(2)
  66. end
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement