Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function register()
- term.clear()
- term.setCursorPos(51,1)
- term.setBackgroundColor(colors.red)
- write("X")
- term.setBackgroundColor(colors.black)
- term.setCursorPos(10,3)
- write("diamondpumpkin's Banking Client")
- term.setCursorPos(18,7)
- write("Login - ")
- term.setTextColor(colors.lightBlue)
- term.setCursorPos(27,7)
- write("Register")
- term.setTextColor(colors.white)
- term.setCursorPos(18,8)
- write("Username: ")
- local input = read()
- user = input
- term.setCursorPos(18,9)
- write("Password: ")
- local input = read("*")
- pass = input
- rednet.send(16, "register", "bank")
- local id, message = rednet.receive()
- if id == 16 then
- if message == "Already logged in." then
- return
- elseif message == "Ready." then
- sleep(0.2)
- rednet.send(16, user, "bank")
- sleep(0.2)
- rednet.send(16, pass, "bank")
- end
- end
- end
- function login()
- term.clear()
- term.setCursorPos(51,1)
- term.setBackgroundColor(colors.red)
- write("X")
- term.setBackgroundColor(colors.black)
- term.setCursorPos(10,3)
- write("diamondpumpkin's Banking Client")
- term.setCursorPos(18,7)
- term.setTextColor(colors.lightBlue)
- write("Login ")
- term.setTextColor(colors.white)
- term.setCursorPos(24,7)
- write("- Register")
- term.setCursorPos(18,8)
- write("Username: ")
- local input = read()
- user = input
- term.setCursorPos(18,9)
- write("Password: ")
- local input = read("*")
- pass = input
- rednet.send(16, "login", "bank")
- local id, message = rednet.receive()
- if id == 16 then
- elseif message == "Ready." then
- sleep(0.2)
- rednet.send(16, user, "bank")
- sleep(0.2)
- rednet.send(16, pass, "bank")
- local id, message = rednet.receive()
- if id == 16 then
- term.setCursorPos(18,10)
- write(message)
- sleep(1)
- if message == "Already logged in." or message == "Logged in." then
- main()
- return
- elseif message == "Incorrect password." then
- return
- end
- end
- end
- end
- end
- function main()
- term.clear()
- term.setCursorPos(1,1)
- x = 0
- y = 1
- while true do
- x = x + 1
- if y == 20 then
- break
- end
- if x == 8 then
- y = y + 1
- x = 0
- end
- term.setCursorPos(x,y)
- term.setTextColor(colors.lightBlue)
- term.setBackgroundColor(colors.lightBlue)
- write(".")
- end
- term.setTextColor(colors.white)
- term.setCursorPos(1,1)
- write("Balance")
- term.setCursorPos(1,2)
- write("Send")
- term.setCursorPos(1,3)
- write("Account")
- term.setCursorPos(1,4)
- write("Logout")
- term.setCursorPos(1,20)
- while true do
- local event, button, x, y = os.pullEvent( "mouse_click" )
- if x >= 1 and x <= 7 and y == 1 then
- balance()
- end
- end
- end
- rednet.open("top")
- term.clear()
- term.setCursorPos(51,1)
- term.setBackgroundColor(colors.red)
- write("X")
- term.setBackgroundColor(colors.black)
- term.setCursorPos(10,3)
- write("diamondpumpkin's Banking Client")
- term.setCursorPos(18,7)
- write("Login - Register")
- while true do
- local event, button, x, y = os.pullEvent( "mouse_click" )
- if x >= 18 and x <= 22 and y == 7 then
- login()
- elseif x >= 26 and x <= 33 and y == 7 then
- register()
- elseif x == 51 and y == 1 then
- term.clear()
- term.setCursorPos(1,1)
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement