xXm0dzXx

Bank <Client>

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