Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- founds = nil
- sidec = 0
- serverid = 784
- slash = "/"
- version = 0.14
- function receive()
- marg={os.pullEvent()}
- if marg[1] == "modem_message" then
- return true
- else
- return false
- end
- end
- function getside()
- return marg[2]
- end
- function getall()
- return marg
- end
- function getfromchan()
- return marg[3]
- end
- function getreplychan()
- return marg[4]
- end
- function getmsg()
- return marg[5]
- end
- function getdistance()
- return marg[6]
- end
- function open(side, chan)
- if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
- local modems = peripheral.wrap(side)
- modems.open(chan)
- else
- print("Modem not present on "..side.."")
- end
- end
- function transmit(chan, replychan, msgtosend)
- local newchan = tonumber(chan)
- local newreplychan = tonumber(replychan)
- sidepresent = nil
- for c = 1, 7 do
- if c == 1 then
- sidetocheck = "right"
- end
- if c == 2 then
- sidetocheck = "left"
- end
- if c == 3 then
- sidetocheck = "back"
- end
- if c == 4 then
- sidetocheck = "front"
- end
- if c == 5 then
- sidetocheck = "top"
- end
- if c == 6 then
- sidetocheck = "bottom"
- end
- if c == 7 then
- if sidepresent == nil then
- return false
- end
- else
- if peripheral.isPresent(sidetocheck) and peripheral.getType(sidetocheck) == "modem" then
- sidepresent = sidetocheck
- end
- end
- end
- local modems = peripheral.wrap(sidepresent)
- modems.transmit(newchan, newreplychan, msgtosend)
- end
- --function seperate()
- -- toreturn = {}
- -- for a, b in string.gmatch(marg[5], "(%S+)") do
- -- toreturn[a] = b
- -- end
- -- return toreturn
- --end
- while not founds do
- sidec = sidec +1
- if sidec == 1 then
- sides = "right"
- elseif sidec == 2 then
- sides = "left"
- elseif sidec == 3 then
- sides = "back"
- elseif sidec == 4 then
- sides = "front"
- elseif sidec == 5 then
- sides = "top"
- elseif sidec == 6 then
- sides = "bottom"
- else
- print("Could not find side!")
- founds = true
- didfind = false
- end
- if peripheral.getType(sides) == "modem" then
- side = sides
- didfind = true
- open(side, 784)
- end
- end
- connected = false
- if didfind == true then
- while not connected == true do
- sleep(0.5)
- transmit(782, 784, "QUEST-CLIENT-"..version.." login ping antihack")
- if receive() then
- antihack = getdistance()
- connected = true
- end
- end
- end
- if didfind == true then
- term.clear()
- term.setCursorPos(1,1)
- print("Have you registered? y/n, yes/no")
- hr = read()
- if not hr == "y" or hr == "yes" then
- term.clear()
- term.setCursorPos(1,1)
- print("Registering a user, type your desired username")
- print("And password, do NOT use your minecraft password")
- print("Rednet is NOT secure!")
- term.setCursorPos(1,4)
- write("Username:")
- term.setCursorPos(11,4)
- usern = read()
- term.setCursorPos(1,5)
- write("Password:")
- term.setCursorPos(11,5)
- pass1 = read()
- term.setCursorPos(1, 6)
- write("Confirm Password:")
- term.setCursorPos(19,6)
- pass2 = read()
- if not pass1 == pass2 then
- print("Passwords do not match!")
- redirect("quest.play/quest")
- end
- print("Sending data to server")
- gotregist = false
- while gotregist ~= true do
- sleep(1)
- transmit(782,784,"QUEST-CLIENT-"..version.." register "..usern.." "..pass2.."")
- if receive() then
- msg = getmsg()
- if msg == "QUEST-SERVER-"..version.." REGISTERED "..antihack.."" then
- print("Register success!")
- print("Reloading Page")
- redirect("quest.play/quest")
- end
- end
- end
- else
- print("please enter your username")
- username = read()
- print("Please enter your password")
- pass = read()
- transmit(782,784, "QUEST-CLIENT-"..version.." request login permission")
- sleep(0.1)
- transmit(782,serverid, "QUEST-CLIENT-"..version.." login ".. username .. " "..pass.."")
- if receive() then
- msg = getmsg()
- if msg == "QUEST-SERVER-"..version.." LOGIN-INCORRECT "..antihack.."" then
- print("Incorrect password")
- sleep(2)
- redirect("quest.play/quest")
- elseif msg == "QUEST-SERVER-"..version.." LOGIN-CORRECT "..antihack.."" then
- print("Correct password")
- runclient = "runclient"
- else
- print("Error")
- sleep(2)
- redirect("quest.play/quest")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment