Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- authData is generated in another script
- local textId = {
- authorization = 777
- }
- local authData = {
- "|14010|20858|20858|20430|21072|21072|21072|20430|21286|21286|21286|20430|21500|21500|21500|7590|10800|11870|12084|11014|6948|9730|6948|11656|17648|11442|14010|24496|11870|21500|25994|16792|25138",
- "|17862|25994|24496|25780|24924|7590|10372|10372|10372|10372|6948|9730|6948|15080|12298|19146|17434|10800|16792|23640|25780|25780|17648",
- "|16364|22570|24068|22570|22998|22570|23640|22142|7590|11228|10586|10586|10800|6948|9730|6948|24710|21286|17434|18076|24924|11014|16150|15936|14224|25994",
- "|18504|22570|23212|23212|20858|20858|20858|23426|7590|10372|10372|10372|10372|6948|9730|6948|15294|15080|21286|23640|25780|15722|17434|12084|21286|12084"
- }
- gen = function()
- local x = tonumber(string.byte('G'))*((math.sqrt(math.sqrt(1/3^-1)*math.sqrt(1/3^-1))*math.sqrt(math.sqrt(1/9^-1)))) + (9/math.sqrt(1/9^-1^1/9^-1))
- return x
- end
- function gen_decode(b)
- local c = ""
- for d,e in next,b do
- c=c..string.char(e/gen())
- end
- return c
- end
- function getInfo(str)
- local chars = {}
- for char in str:gmatch("%d+[^|]") do
- chars[#chars + 1] = tonumber(char)
- end
- return chars
- end
- function eventPopupAnswer(popupID, playerName, answer)
- if popupID == textId.authorization then
- local key
- local name
- local authPos
- for i = 1, #authData do
- local index = gen_decode(getInfo(authData[i])):match("([%w_+]+#%d%d%d%d)")
- if index == playerName then
- authPos = i
- end
- end
- if not authPos then
- print("<R>Name not found in database. Exiting... <N>["..playerName.."]")
- return
- else
- print("<BV>Name found in database. Confirming the key... <N>["..playerName.."]")
- end
- for nick, tag, auth in gen_decode(getInfo(authData[authPos])):gmatch("([%w_+]+)#(%d%d%d%d)(.*)") do
- name = nick .. "#" .. tag
- key = auth:match("[%w_+]+")
- end
- if answer == key and playerName == name then
- print("<J>"..answer.."</J> <VP>[CORRECT]</VP>")
- print('<VP>Authorized succesfully. Initializing the script</VP>')
- elseif answer == key and playerName ~= name then
- print("<J>"..answer.."</J>")
- print('<R>Name not valid. Exiting the script...</R>')
- elseif answer ~= key and playerName == name then
- print("<R>"..answer.." [INCORRECT]</R>")
- print('<R>Authorization key not valid. Exiting the script...</R>')
- end
- end
- end
- function eventChatCommand(name, cmd)
- if cmd == "auth" then
- ui.addPopup(textId.authorization, 2, "<j>Enter auth key</j>", name, 350, 150, 125, false)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement