xXm0dzXx

Untitled

May 26th, 2012
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. local status = "Please login first."
  2. local user = "Login";
  3. local x,y = term.getSize()
  4. local page = "Home";
  5.  
  6. local lPrint = function(text)
  7. local x2,y2 = term.getCursorPos()
  8. term.setCursorPos(math.ceil(x - text:len()), y2)
  9.  
  10. write(text)
  11. end
  12.  
  13. function connect()
  14. while true do
  15. term.clear()
  16. term.setCursorPos(1,1)
  17. print(status.. "\n")
  18. print("Minecraft Username: ")
  19. write("Minecraft Password: ")
  20. test = string.len("Minecraft Password: *")
  21.  
  22. term.setCursorPos(test, 3)
  23. user = read()
  24. term.setCursorPos(test, 4)
  25. pass = read("*")
  26. http.request("http://login.minecraft.net/?user=" ..user.. "&password=" ..pass.. "&version=12")
  27. local event, url, response = os.pullEvent()
  28. if event == "http_success" then
  29. _sResponse = { response.readAll() }
  30. if string.find(tostring(_sResponse[1]), "deprecated") then
  31. term.setCursorPos(1, y-1)
  32. textutils.slowPrint("Logging in...")
  33. sleep(0.5)
  34. break
  35. else
  36. status = tostring(_sResponse[1])
  37. end
  38. else
  39. status = ("Unable to connect to minecraft.net")
  40. end
  41.  
  42. response.close()
  43. end
  44.  
  45. load()
  46. end
  47.  
  48. function homepage()
  49. term.clear()
  50. term.setCursorPos(1,1)
  51. write("Minebook")
  52. lPrint("1; Login")
  53. for i = 1,x-1 do
  54. term.setCursorPos(i, 2)
  55. write("-")
  56. end
  57. term.setCursorPos(1,y)
  58. write("English (US)")
  59. repeat
  60. local event, a = os.pullEvent("key")
  61. until a == 2
  62.  
  63. connect()
  64. end
  65.  
  66. function tabs()
  67. term.clear()
  68. term.setCursorPos(1,1)
  69. write("Minebook")
  70. lPrint(user.. " | 1; Home | v; Logout")
  71. for i = 1,x-1 do
  72. term.setCursorPos(i, 2)
  73. write("-")
  74. end
  75. term.setCursorPos(1,y)
  76. write("English (US)")
  77. repeat
  78. local event, a = os.pullEvent("char")
  79. until a == "v" or a == "V"
  80.  
  81. homepage()
  82. end
  83.  
  84. function load()
  85. tabs()
  86. end
  87.  
  88. homepage()
Advertisement
Add Comment
Please, Sign In to add comment