xXm0dzXx

Untitled

Jul 16th, 2012
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. rednet.open("top")
  3. local bankID = 217;
  4. local w, h = term.getSize()
  5.  
  6. function cPrint(str, ypos)
  7. term.setCursorPos(w/2-#str/2, ypos)
  8. write(str)
  9. end
  10.  
  11. function clear()
  12. term.clear()
  13. term.setCursorPos(1,1)
  14. end
  15.  
  16. print("Entering fullscreen in 3...")
  17. sleep(1)
  18. print("2...")
  19. sleep(1)
  20. print("1...")
  21. sleep(1)
  22. selection = 1
  23.  
  24. while true do
  25. clear()
  26. if selection == 1 then
  27. print("> Login < Register \n")
  28. else
  29. print(" Login > Register <\n")
  30. end
  31.  
  32. cPrint("+-------------------+", 3)
  33. cPrint("| |", 4)
  34. cPrint("| Username: |", 5)
  35. cPrint("| Password: |", 6)
  36. cPrint("| |", 7)
  37. cPrint("+-------------------+", 8)
  38.  
  39. local event, key = os.pullEvent("key")
  40.  
  41. if key == 203 then
  42. selection = 1
  43. elseif key == 205 then
  44. selection = 94897983697
  45. elseif key == 28 then
  46. break
  47. end
  48. end
  49.  
  50. statusMessage = "| |"
  51.  
  52. while true do
  53. clear()
  54. cPrint("+-------------------+", 3)
  55. cPrint(statusMessage, 4)
  56. cPrint("| Username: |", 5)
  57. cPrint("| Password: |", 6)
  58. cPrint("| |", 7)
  59. cPrint("+-------------------+", 8)
  60.  
  61. str = "| Username: |"
  62. map = w/2-#str/2+string.len("| Username: ")
  63. term.setCursorPos(map, 5)
  64. username = read()
  65. term.setCursorPos(map, 6)
  66. password = read()
  67.  
  68. if selection == 1 then
  69. rednet.send(bankID, "VERIFY:" ..username.. ":" ..password)
  70. repeat
  71. id, message = rednet.receive()
  72. until id == bankID
  73.  
  74. if message == "Correct" then
  75. break
  76. else
  77. statusMessage = "| Login failed. |"
  78. end
  79. else
  80. break
  81. end
  82. end
  83.  
  84. if username == "" and password == "" then
  85. clear()
  86. shell.run("shell")
  87. else
  88. if selection == 94897983697 then
  89. rednet.send(bankID, "NEW:" ..username.. ":" ..password)
  90. end
  91.  
  92. function updateBalance()
  93. rednet.send(bankID, "CHECK:" ..username)
  94. repeat
  95. id, balance = rednet.receive()
  96. until id == bankID
  97.  
  98. print("Balance: " ..balance.. "$ (CTRL = Update)")
  99. end
  100.  
  101. function hai()
  102. clear()
  103. print("Welcome, " ..username.. "!")
  104. updateBalance()
  105. for i=1,w-1 do
  106. write("-")
  107. end
  108.  
  109. print("Recent Actions: ")
  110. print("<Coming Soon>\n")
  111. print("Press Enter to donate.")
  112. while true do
  113. event, key = os.pullEvent("key")
  114. if key == 29 then
  115. hai()
  116. elseif key == 28 then
  117. donate()
  118. end
  119. end
  120. end
  121.  
  122. function donate()
  123. clear()
  124. write("Who would you like to donate to? ")
  125. input = read()
  126. write("How much would you like to donate? $")
  127. test = read()
  128.  
  129. --GIVE:<YOUR NAME>:<YOUR PASS>:<HOW MUCH U WANNA GIVE TO...>:<YOUR FRIEND>
  130. rednet.send(bankID, "GIVE:" ..username.. ":" ..password.. ":" ..test.. ":" ..input)
  131. hai()
  132. end
  133.  
  134. hai()
  135. end
Advertisement
Add Comment
Please, Sign In to add comment