PtokaX forum

Archive => Archived 5.1 boards => Conversion Requests => Topic started by: Tw?sT?d-d?v on 21 July, 2007, 22:31:50

Title: YnHub Register to PtokaX
Post by: Tw?sT?d-d?v on 21 July, 2007, 22:31:50
If not to much trouble can some1 convert this to work in latest PtokaX ( or point me to a working version )

--//----------------------------------------------------------------------------------------------->>
--//-- Convert YnHub Register to PtokaX
--//-- Created by NightLitch 2005-04-23
--//-- To start the convert use specified command bellow in mainchat
--//-- Usage: #convert
--//----------------------------------------------------------------------------------------------->>

--//-- Specify the YnHub Profiles to work with your PtokaX Profiles
--//-- YnHub Profiles   =   PtokaX Profiles
ProfileRegistry = {
["Supreme-Owner"] = "NetFounder",
["Owner"] = "Master",
["Admin"] = "Moderator",
["TiB-Admin"] = "Moderator",
["TiB"] = "Operator",
["OP"] = "Operator",
["VIP"] = "VIP",
["Registered"] = "Reg",
}

--//-- Specify the Path to YnHubs Register File
FileName = "C:\Users\Twisted\Documents\My Received Files\accounts.xml"

--//----------------------------------------------------------------------------------------------->>
--//-- Don't Edit
--//----------------------------------------------------------------------------------------------->>
function ConvertYnHubRegisterFile(filename)
    local curTable = {}
    local curNick = ""
    local Count = 0
    local file = io.open(filename, "r")
    for line in file:lines() do
        local s,e,col,value = string.find(line, "<(%S+)>(%S+)<")
        if col and value then
            if col == "Nick" and Count == 0 then
                curNick = value
                curTable[value] = {["Pass"] = "", ["Profile"] = ""}
                Count = Count + 1
            elseif col == "Pass" and Count == 1 then
                curTable[curNick].Pass = value
                Count = Count + 1
            elseif col == "Profile" and Count == 2 then
                curTable[curNick].Profile = value
                Count = 0
            end
        end
    end
    file:close()
    return curTable
end

function ChatArrival(sUser,sData)
local _,_,Cmd = string.find(sData, "%b<>%s*(%S+)%|")
if Cmd == "#convert" then
sUser:SendData("Converter","Start Converting YnHub register into PtokaX register")
local T = ConvertYnHubRegisterFile(FileName)
local t,g,b = 0,0,0
for nick,_ in T do
t = t + 1
if ProfileRegistry[T[nick].Profile] and GetProfileIdx(ProfileRegistry[T[nick].Profile]) ~= -1 then
g = g + 1
AddRegUser(nick,T[nick].Pass, GetProfileIdx(ProfileRegistry[T[nick].Profile]))
else
b = b +1
end
end
sUser:SendData("Converter", "*** Total ( "..t.." ) registered user(s) is found in YnHub")
sUser:SendData("Converter","*** Total ( "..g.." ) user(s) are registered to PtokaX registry")
sUser:SendData("Converter","*** Total ( "..b.." ) user(s) is not registered because profiles doesn't exist in PtokaX")
return 1
end
end
Title: Re: YnHub Register to PtokaX
Post by: Tw?sT?d-d?v on 21 July, 2007, 23:26:31
t6hx m8  working here now  :)
Title: Re: YnHub Register to PtokaX
Post by: ExtreeM on 08 December, 2007, 13:37:27
what seems to be tha problem here???

--//----------------------------------------------------------------------------------------------->>
--//-- Convert YnHub Register to PtokaX
--//-- Created by NightLitch 2005-04-23
--//-- To start the convert use specified command bellow in mainchat
--//-- Usage: #convert
--//----------------------------------------------------------------------------------------------->>

--//-- Specify the YnHub Profiles to work with your PtokaX Profiles
--//-- YnHub Profiles   =   PtokaX Profiles
ProfileRegistry = {
["Owner"] = "Master",
["SU"] = "Operator",
["DUMP"] = "Operator",
["OP"] = "Operator",
["VIP"] = "VIP",
["VIP1"] = "VIP",
["VIP2"] = "VIP",
["VIP3"] = "VIP",
["Temp"] = "VIP",
["Musik"] = "VIP",
["FOR BOTS"] = "VIP",
["Registered"] = "Reg",
}

--//-- Specify the Path to YnHubs Register File
FileName = "E:\Ynhub\settings\accounts.xml"

--//----------------------------------------------------------------------------------------------->>
--//-- Don't Edit
--//----------------------------------------------------------------------------------------------->>
function ConvertYnHubRegisterFile(filename)
    local curTable = {}
    local curNick = ""
    local Count = 0
    local file = io.open(filename, "r")
    for line in file:lines() do
        local s,e,col,value = string.find(line, "<(%S+)>(%S+)<")
        if col and value then
            if col == "Nick" and Count == 0 then
                curNick = value
                curTable[value] = {["Pass"] = "", ["Profile"] = ""}
                Count = Count + 1
            elseif col == "Pass" and Count == 1 then
                curTable[curNick].Pass = value
                Count = Count + 1
            elseif col == "Profile" and Count == 2 then
                curTable[curNick].Profile = value
                Count = 0
            end
        end
    end
    file:close()
    return curTable
end

function ChatArrival(sUser,sData)
local _,_,Cmd = string.find(sData, "%b<>%s*(%S+)%|")
if Cmd == "#convert" then
sUser:SendData("Converter","Start Converting YnHub register into PtokaX register")
local T = ConvertYnHubRegisterFile(FileName)
local t,g,b = 0,0,0
for nick,_ in pairs(T) do
t = t + 1
if ProfileRegistry[T[nick].Profile] and GetProfileIdx(ProfileRegistry[T[nick].Profile]) ~= -1 then
g = g + 1
AddRegUser(nick,T[nick].Pass, GetProfileIdx(ProfileRegistry[T[nick].Profile]))
else
b = b +1
end
end
sUser:SendData("Converter", "*** Total ( "..t.." ) registered user(s) is found in YnHub")
sUser:SendData("Converter","*** Total ( "..g.." ) user(s) are registered to PtokaX registry")
sUser:SendData("Converter","*** Total ( "..b.." ) user(s) is not registered because profiles doesn't exist in PtokaX")
return 1
end
end
--// NightLitch
Title: Re: YnHub Register to PtokaX
Post by: Gnuff? on 29 December, 2007, 22:13:41
I guess this:
FileName = "E:\Ynhub\settings\accounts.xml"
should be:
FileName = "E:\\Ynhub\\settings\\accounts.xml"