Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function center(sText)
- local w, h = term.getSize()
- local x, y = term.getCursorPos()
- x = math.max(math.floor(( w / 2) - (#sText / 2)), 0)
- term.setCursorPos(x, y)
- print(sText)
- end
- rednet.open("top")
- term.setBackgroundColor(colors.blue)
- term.clear()
- term.setCursorPos(1,1)
- center("HouseCloud")
- term.setCursorPos(22,8)
- term.setBackgroundColor(colors.lightBlue)
- print("Login")
- term.setCursorPos(20,10)
- print("Register")
- term.setCursorPos(22, 15)
- print("Exit")
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if x >= 22 and x < 27 and y == 15 then
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- break
- elseif x >= 22 and x < 28 and y == 8 then
- term.clear()
- term.write("Username: ")
- user = read()
- term.write("Password: ")
- pass = read("*")
- print("Logging in...")
- rednet.broadcast("login", user, pass)
- id, message = rednet.receive()
- if message == "nousrexist" then
- print(user, " does not exist!")
- os.sleep(1)
- os.reboot()
- elseif message == "sendestring" then
- local tmpkey = encryption.generateKey(30) -- Makes Session Key
- local key = tostring(tmpkey)
- rednet.broadcast("estringsent", key)
- print("Sucessful!")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement