Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local version = "1.07" --change this to allow for an update (3 chars only)
- local filename = "MCReg" --change this to the name of the file holding this program
- local paste = "RRANf6PW" --change this to the pastebin entry code
- local function update()
- local url = "http://pastebin.com/raw/"..paste
- local temp = http.get(url)
- local ver = string.sub(temp.readLine(), 18, 21)
- if ver ~= version then
- fs.delete(filename)
- shell.run("pastebin get "..paste.." "..filename)
- shell.run(filename)
- return true
- end
- return false
- end
- --start
- if update() then
- error()
- end
- shell.run("clear")
- --not mine
- local function split(str)
- local t = {} -- NOTE: use {n = 0} in Lua-5.0
- local fpat = "(.-)" .. ":" --character to use
- local last_end = 1
- local s, e, cap = str:find(fpat, 1)
- while s do
- if s ~= 1 or cap ~= "" then
- table.insert(t,cap)
- end
- last_end = e+1
- s, e, cap = str:find(fpat, last_end)
- end
- if last_end <= #str then
- cap = str:sub(last_end)
- table.insert(t, cap)
- end
- return t
- end
- --host protocol for id
- --rednet.host("MCAuth","AuthenticationServer")
- rednet.open("top")
- shell.run("clear")
- local name, age, pass, confirm
- print("~Welcome to MCRegister~\n")
- print("This will take your information and upload it to the main network.")
- term.write("MC Username: ")
- name = read()
- term.write("\nAge: ")
- age = read()
- term.write("\nPassword: ")
- pass = read("*")
- term.write("Retype password: ")
- confirm = read("*")
- shell.run("clear")
- if pass == confirm then
- print("Finding Server..")
- local id = rednet.lookup("MCAuth","AuthenticationServer")
- if id ~= nil then
- print("Found Server! Sending Data..")
- rednet.send(id, "$REGISTER$:"..name..":"..pass..":"..age)
- print("Waiting for reply..")
- local go = true
- while go do
- local rID,msg = rednet.receive()
- if rID == id then
- go = false
- print(msg)
- end
- end
- else
- print("No Servers Found!")
- end
- else
- print("Passwords do not match.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement