Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- local sId = rednet.lookup("bank", "server")
- if not sId then
- error("Server is not online")
- end
- local function sMsg(msg)
- rednet.send(sId, msg, "bank")
- end
- local function rMsg()
- local time = os.startTimer(1)
- while true do
- local ev, p1, p2, p3 = os.pullEvent()
- if ev == "rednet_message" then
- if p1 == sId and p3 == "bank" then
- return p2
- end
- elseif ev == "timer" and p1 == time then
- return false
- end
- end
- end
- local function register(user, pass)
- sMsg(textutils.serialize({"register", user, pass}))
- local resp = rMsg()
- if not resp then
- return false, "No response"
- else
- return resp
- end
- end
- local function transact(user, amount, recipient)
- sMsg(textutils.serialize({"transact",user, amount, recipient}))
- local resp = rMsg()
- if not resp then
- return false, "No response"
- else
- return resp
- end
- end
- --print(register("jojoisawsome", "genericPassword"))
- --print(transact("jojoisawsome", 1, "nillogic"))
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("Username: ")
- term.setCursorPos(1,2)
- local username = string.lower(read())
- term.setCursorPos(1,3)
- print("Password: ")
- term.setCursorPos(1,4)
- local password = string.lower(read("*"))
- term.clear()
- term.setCursorPos(1,1)
- print(username.."'s account")
- term.setCu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement