SHOW:
|
|
- or go back to the newest paste.
| 1 | fileName = "client" | |
| 2 | if(fs.exists(fileName) == true)then | |
| 3 | print("Installing BlueBank Client System")
| |
| 4 | shell.run("rename "..fileName.." startup")
| |
| 5 | sleep(5) | |
| 6 | - | ser = 32 -- Change To Server's ID# |
| 6 | + | os.reboot() |
| 7 | - | side = "top" -- Modem Side |
| 7 | + | |
| 8 | - | rednet.open(side) -- Don't Change This (End of Setup) |
| 8 | + | |
| 9 | --[ BlueBank Client by TrumpetMiner v3.5 | |
| 10 | --[ pastebin get bpf4TVGb client | |
| 11 | --[ Setup | |
| 12 | log = 0 -- Don't Change This! | |
| 13 | logU = "Guest" -- Don't Worry About This | |
| 14 | side = nil | |
| 15 | ser = nil -- Change To Server's ID# | |
| 16 | function getserver() | |
| 17 | local fname = "ServerID" | |
| 18 | if fs.exists(fname) then | |
| 19 | file = fs.open(fname, "r") | |
| 20 | ser = tonumber(file.readAll()) | |
| 21 | file.close() | |
| 22 | print("Server ID: "..ser)
| |
| 23 | else | |
| 24 | print("No server configured")
| |
| 25 | print("This ID is: ".. os.getComputerID())
| |
| 26 | term.write("Server ID: ")
| |
| 27 | ser = io.read() | |
| 28 | file = fs.open(fname, "w") | |
| 29 | file.write(ser) | |
| 30 | file.close() | |
| 31 | ser = tonumber(ser) | |
| 32 | end | |
| 33 | end | |
| 34 | getserver() | |
| 35 | ||
| 36 | -- Determine where the modem is. | |
| 37 | print("Looking for modem,")
| |
| 38 | if peripheral.isPresent("left") and peripheral.getType("left")=="modem" then
| |
| 39 | side = "left" | |
| 40 | elseif peripheral.isPresent("right") and peripheral.getType("right")=="modem" then
| |
| 41 | side = "right" | |
| 42 | elseif peripheral.isPresent("top") and peripheral.getType("top")=="modem" then
| |
| 43 | side = "top" | |
| 44 | elseif peripheral.isPresent("back") and peripheral.getType("back")=="modem" then
| |
| 45 | side = "back" | |
| 46 | elseif peripheral.isPresent("bottom") and peripheral.getType("bottom")=="modem" then
| |
| 47 | side = "bottom" | |
| 48 | else | |
| 49 | print("No Modem Found")
| |
| 50 | side = false | |
| 51 | end | |
| 52 | while side == false do | |
| 53 | ||
| 54 | sleep(5) | |
| 55 | shell.run("startup")
| |
| 56 | ||
| 57 | end | |
| 58 | print("Modem found on "..side)
| |
| 59 | rednet.open(side) | |
| 60 | -- Functions | |
| 61 | function start() | |
| 62 | backC(8) | |
| 63 | textC(16) | |
| 64 | term.clear() | |
| 65 | cur(1,1) | |
| 66 | print("Welcome, "..logU)
| |
| 67 | if log == 1 then | |
| 68 | cur(3,4) | |
| 69 | print "[Logout]" | |
| 70 | cur(3,6) | |
| 71 | print "[Balance]" | |
| 72 | cur(3,8) | |
| 73 | print "[Transfer]" | |
| 74 | else | |
| 75 | cur(3,4) | |
| 76 | print "[Login]" | |
| 77 | cur(3,6) | |
| 78 | print "[Create Account]" | |
| 79 | end | |
| 80 | event, button, X, Y = os.pullEvent("mouse_click")
| |
| 81 | if X >= 3 and X <= 10 and Y == 4 and log == 0 then | |
| 82 | rednet.send(ser,"Login") | |
| 83 | term.clear() | |
| 84 | cur(3,4) | |
| 85 | write "User: " | |
| 86 | user = read() | |
| 87 | cur(3,5) | |
| 88 | write "Pass: " | |
| 89 | pass = read("*")
| |
| 90 | rednet.send(ser,user) | |
| 91 | rednet.send(ser,pass) | |
| 92 | ser, message = rednet.receive() | |
| 93 | if message == "Login Successful" then | |
| 94 | log = 1 | |
| 95 | logU = user | |
| 96 | end | |
| 97 | cur(3,2) | |
| 98 | print(message) | |
| 99 | sleep(1) | |
| 100 | start() | |
| 101 | elseif X >= 3 and X <= 10 and Y == 4 and log == 1 then | |
| 102 | log = 0 | |
| 103 | logU = "Guest" | |
| 104 | start() | |
| 105 | elseif X >= 3 and X <= 11 and Y == 6 and log == 1 then | |
| 106 | rednet.send(ser,"Balance") | |
| 107 | sleep(.5) | |
| 108 | rednet.send(ser,logU) | |
| 109 | ser, bal = rednet.receive() | |
| 110 | term.clear() | |
| 111 | cur(1,1) | |
| 112 | print("Balance is $"..bal)
| |
| 113 | os.pullEvent("mouse_click")
| |
| 114 | start() | |
| 115 | elseif X >= 3 and X <= 12 and Y == 8 and log == 1 then | |
| 116 | rednet.send(ser,"Transfer") | |
| 117 | term.clear() | |
| 118 | cur(3,4) | |
| 119 | write "Amount: $" | |
| 120 | am = read() | |
| 121 | cur(3,6) | |
| 122 | write "To User: " | |
| 123 | user2 = read() | |
| 124 | rednet.send(ser,logU) | |
| 125 | rednet.send(ser,user2) | |
| 126 | rednet.send(ser,am) | |
| 127 | id, message = rednet.receive() | |
| 128 | cur(3,2) | |
| 129 | print(message) | |
| 130 | os.pullEvent("mouse_click")
| |
| 131 | start() | |
| 132 | elseif X >= 3 and X <= 18 and Y == 6 and log == 0 then | |
| 133 | term.clear() | |
| 134 | cur(3,4) | |
| 135 | write "Username: " | |
| 136 | user = read() | |
| 137 | term.clear() | |
| 138 | cur(3,4) | |
| 139 | write "Passcode: " | |
| 140 | pass = read() | |
| 141 | term.clear() | |
| 142 | rednet.send(ser,"Create") | |
| 143 | rednet.send(ser,user) | |
| 144 | rednet.send(ser,pass) | |
| 145 | id, msg = rednet.receive() | |
| 146 | cur(3,4) | |
| 147 | print(msg) | |
| 148 | os.pullEvent("mouse_click")
| |
| 149 | start() | |
| 150 | else | |
| 151 | start() | |
| 152 | end | |
| 153 | end | |
| 154 | function cur(cX,cY) | |
| 155 | term.setCursorPos(cX,cY) | |
| 156 | end | |
| 157 | function backC(color) | |
| 158 | term.setBackgroundColor(color) | |
| 159 | end | |
| 160 | function textC(color) | |
| 161 | term.setTextColor(color) | |
| 162 | end | |
| 163 | -- Programs | |
| 164 | start() |