Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --changelog
- --CURRENT: - v0.3.4 - Security question!
- --v0.3.3 - updated something
- --v0.3.2 - Added line 18 - 24, Fixed error of nil, Fixed Lot of thing
- --v0.3.1 - Fixed serverID
- --v0.3 - NICKNAME!
- --v0.2.1 - Fixed serverID
- --v0.2 - allow to change username & password
- --v0.1 - Published
- --Pre-Pre-Alpla version
- --v0.05 - Fixed some bug
- --v0.01 - Born
- local serverID
- print("serverID is?")
- term.setCursorPos(1, 2)
- serverID = read()
- sleep(1)
- term.clear()
- local function enter(username)
- local nick
- repeat
- rednet.send(serverID, "user")
- sleep(0.5)
- rednet.send(serverID, username)
- sleep(0.5)
- rednet.send(serverID, "check")
- sleep(0.5)
- rednet.send(serverID, "could")
- local ID, MSG, DISTANCE = rednet.receive(10)
- if MSG == "nope" or MSG == nil or MSG == "" then
- print("Hello, "..username)
- elseif MSG == "yes" then
- local ID, MSG, DISTANCE = rednet.receive(10)
- nick = MSG
- print("Hello, "..nick)
- end
- print("(1)Edit username")
- print("(2)Edit password")
- print("(3)Edit nick")
- print("(4)Edit Security question")
- print("(5)Logout")
- print("1, 2, 3 ,4 or 5?")
- print(">")
- term.setCursorPos(2, 8)
- local num = read()
- if num == "1" then
- local nameuser
- repeat
- term.setCursorPos(1, 5)
- print(" ")
- print(" ")
- term.setCursorPos(1, 3)
- print("New username:")
- print("> ")
- term.setCursorPos(2, 4)
- nameuser = read()
- term.setCursorPos(1, 5)
- print("Need to change? n for no, y for yes")
- change = read()
- until change == "n"
- term.setCursorPos(1, 5)
- print(" ")
- print(" ")
- term.setCursorPos(1, 5)
- print("Please wait...")
- rednet.send(serverID, "user")
- sleep(0.5)
- rednet.send(serverID, username)
- sleep(0.5)
- rednet.send(serverID, "user2")
- sleep(0.5)
- rednet.send(serverID, nameuser)
- sleep(0.5)
- rednet.send(serverID, "cn")
- term.setCursorPos(3, 6)
- print("Comfirming...")
- sleep(0.5)
- rednet.send(serverID, "could")
- local ID, MSG, DISTANCE = rednet.receive(10)
- if MSG == "finish" then
- does = "no"
- term.setCursorPos(1, 8)
- print("Please login with your new username.")
- sleep(3)
- dooo = "yes"
- elseif MSG == "nou" then
- term.setCursorPos(1, 8)
- print("New username exist.")
- sleep(2)
- else
- term.setCursorPos(1, 8)
- print("Server closed.")
- sleep(2)
- end
- elseif num == "2" then
- local password,wordpass
- repeat
- term.setCursorPos(1, 7)
- print(" ")
- print(" ")
- term.setCursorPos(1, 3)
- print("Old password:")
- print("> ")
- print("New password:")
- print("> ")
- term.setCursorPos(2, 4)
- password = read("x")
- term.setCursorPos(2, 6)
- wordpass = read("x")
- term.setCursorPos(1, 7)
- print("Need to change? n for no, y for yes")
- term.setCursorPos(1, 8)
- change = read()
- until change == "n"
- term.setCursorPos(1, 7)
- print(" ")
- print(" ")
- term.setCursorPos(1, 7)
- print("Please wait...")
- rednet.send(serverID, "user")
- sleep(0.5)
- rednet.send(serverID, username)
- sleep(0.5)
- rednet.send(serverID, "pass")
- sleep(0.5)
- rednet.send(serverID, password)
- sleep(0.5)
- rednet.send(serverID, "pass2")
- sleep(0.5)
- rednet.send(serverID, wordpass)
- sleep(0.5)
- rednet.send(serverID, "cp")
- term.setCursorPos(1, 8)
- print("Comfirming...")
- sleep(0.5)
- rednet.send(serverID, "could")
- local ID, MSG, DISTANCE = rednet.receive(10)
- if MSG == "finish" then
- term.setCursorPos(1, 7)
- print("Changed password.")
- print("Please login with your new password.")
- sleep(3)
- dooo = "yes"
- elseif MSG == "wrongp" then
- term.setCursorPos(1, 7)
- print("Wrong Old password.")
- sleep(2)
- else
- term.setCursorPos(1, 7)
- print("Server closed.")
- sleep(2)
- end
- elseif num == "3" then
- local nick2
- repeat
- term.setCursorPos(1, 5)
- print(" ")
- print(" ")
- term.setCursorPos(1, 3)
- print("Nickname:")
- print("> ")
- term.setCursorPos(2, 4)
- nick2 = read()
- term.setCursorPos(1, 5)
- print("Need to change? n for no, y for yes")
- term.setCursorPos(1, 6)
- change = read()
- until change == "n"
- term.setCursorPos(1, 5)
- print(" ")
- print(" ")
- term.setCursorPos(1, 5)
- print("Please wait...")
- rednet.send(serverID, "user")
- sleep(0.5)
- rednet.send(serverID, username)
- sleep(0.5)
- rednet.send(serverID, "nick")
- sleep(0.5)
- rednet.send(serverID, nick2)
- sleep(0.5)
- rednet.send(serverID, "nc")
- term.setCursorPos(1, 6)
- print("Comfirming...")
- sleep(0.5)
- rednet.send(serverID, "could")
- local ID, MSG, DISTANCE = rednet.receive(10)
- if MSG == "finishn" then
- does = "no"
- term.setCursorPos(1, 8)
- print("You have changed your nickname.")
- sleep(3)
- elseif MSG == "non" then
- term.setCursorPos(1, 8)
- print("New nickname exist.")
- sleep(2)
- else
- term.setCursorPos(1, 7)
- print("Server closed.")
- sleep(2)
- end
- elseif num == "4" then
- drawmenu()
- local question,answer
- repeat
- term.setCursorPos(1, 7)
- print("| |")
- print("| |")
- term.setCursorPos(1, 3)
- print("Security Question:")
- print("> |")
- print("Answer:")
- print("> |")
- term.setCursorPos(2, 4)
- question = read()
- term.setCursorPos(2, 6)
- answer = read()
- term.setCursorPos(1, 7)
- print("Need to change? n for no, y for yes")
- term.setCursorPos(1, 8)
- change = read()
- until change == "n"
- term.setCursorPos(1, 7)
- print("| |")
- print("| |")
- term.setCursorPos(1, 7)
- print("Please wait...")
- rednet.send(serverID, "user")
- sleep(0.5)
- rednet.send(serverID, username)
- sleep(0.5)
- rednet.send(serverID, "ques")
- sleep(0.5)
- rednet.send(serverID, question)
- sleep(0.5)
- rednet.send(serverID, "ans")
- sleep(0.5)
- rednet.send(serverID, answer)
- sleep(0.5)
- rednet.send(serverID, "secur")
- print("Comfirming...")
- sleep(0.5)
- rednet.send(serverID, "could")
- local ID, MSG, DISTANCE = rednet.receive(10)
- if MSG == "qdone" then
- print("Updated Security Question")
- sleep(3)
- else
- print("Server Closed")
- sleep(2)
- end
- elseif num == "5" then
- drawmenu()
- term.setCursorPos(3, 3)
- if nick == nil or nick == "" then
- print("Bye, "..username)
- else
- print("Bye, "..nick)
- end
- sleep(2)
- dooo = "yes"
- end
- local function login(rl)
- local username,password
- repeat
- term.setCursorPos(1, 9)
- print(" ")
- print(" ")
- term.setCursorPos(1, 7)
- print("Username: ")
- print("Password: ")
- term.setCursorPos(10, 7)
- username = read()
- term.setCursorPos(10, 8)
- password = read("x")
- term.setCursorPos(1, 9)
- print("need to change? y for yes, n for no")
- term.setCursorPos(1, 10)
- local change = read()
- until change == "n"
- term.setCursorPos(1, 9)
- print(" ")
- print(" ")
- term.setCursorPos(1, 10)
- print("Please wait while we sending your username..")
- rednet.send(serverID, "user")
- sleep(1)
- print("Done.")
- rednet.send(serverID, username)
- sleep(0.5)
- print("Please wait while we sending your password..")
- rednet.send(serverID, "pass")
- sleep(1)
- print("Done.")
- rednet.send(serverID, password)
- sleep(0.5)
- rednet.send(serverID, rl)
- sleep(0.5)
- rednet.send(serverID, "could")
- term.setCursorPos(3, 14)
- print("Completed.")
- local ID, MSG, DISTANCE = rednet.receive(10)
- if MSG == "complete" then
- term.setCursorPos(1, 15)
- print("You have registered.")
- sleep(3)
- elseif MSG == "correct" then
- term.setCursorPos(1, 15)
- print("You have logged in.")
- sleep(3)
- enter(username)
- elseif MSG == "pass" then
- term.setCursorPos(1, 15)
- print("Invalid password.")
- sleep(3)
- elseif MSG == "wrong" then
- term.setCursorPos(1, 15)
- print("Invalid username.")
- sleep(3)
- elseif MSG == "no" then
- term.setCursorPos(1, 15)
- print("Username exist.")
- sleep(3)
- else
- term.setCursorPos(1, 15)
- print("Server closed.")
- sleep(3)
- end
- end
- term.setCursorPos(1, 1)
- print("Register or login?(type r/l)")
- term.setCursorPos(1, 2)
- rl = read()
- term.setCursorPos(1, 4)
- if rl == "r" then
- print("register:")
- login(rl)
- elseif rl == "l" then
- print("login:")
- login(rl)
- else
- print("what is "..rl.."?")
- term.setCursorPos(3, 7)
- print("r for register, l for login")
- term.setCursorPos(3, 8)
- print("back to menu")
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement