Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Bank server program--
- --Must be startup program--
- --Must be a directory called saves on the computer--
- term.clear()
- rednet.open("top")
- os.loadAPI("bankAPI.lua")
- term.setCursorPos(1, 1)
- shell.openTab("control.lua")
- while true do
- local ret, msg, pro = rednet.receive("banking")
- -- make log file thing
- print(" ")
- printError(os.date())
- --write date and time at start of each log
- for k, v in pairs(msg) do
- write(v)
- write(" & ")
- --write v to file
- end
- if msg[1] == "bal" then
- local succ, resp = bankAPI.balance(msg[2], msg[3], msg[4])
- local msgR = {"balR", succ, resp}
- rednet.send(ret, msgR, "banking")
- elseif msg[1] == "dep" then
- local succ, resp = bankAPI.deposit(msg[2], msg[3], msg[4], msg[5])
- local msgR = {"depR", succ, resp}
- rednet.send(ret, msgR, "banking")
- elseif msg[1] == "wit" then
- local succ, resp = bankAPI.withdraw(msg[2], msg[3], msg[4], msg[5])
- local msgR = {"witR", succ, resp}
- rednet.send(ret, msgR, "banking")
- elseif msg[1] == "tra" then
- local succ, resp = bankAPI.transfer(msg[2], msg[3], msg[4], msg[5], msg[6])
- local msgR = {"traR", succ, resp}
- rednet.send(ret, msgR, "banking")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement