Jump to content

Problem z logowaniem XML


Recommended Posts

Witam, mam problem ze skryptem, działa on tylko do jednej linijki w xml np dla hehe1 zadziała ale już dla hehe2, hehe3, hehe4 itp już nie zadziała.

Np nick eSkill działa ale już NNocek nie działa, tak jak napisałem w pierwszym zdaniu, pobiera tylko dane z pierwszej linijki w xml.

<uzytkownicy> 
    <konto> 
        <user username="eSkill" haslo="BE82876F4CE7FF1C93C8D9B3A1032" kasa="50000" skin="0"></user> 
        <user username="NNocek" haslo="D5749AA3DF5378F5E76AE292E0DE5" kasa="0" skin="0"></user> 
    </konto> 
</uzytkownicy> 

-- Weryfikacja użytkownika 
function LoginXD(player, username, password) 
    if username and password then 
        local md5pass=md5(password) 
        local xml=xmlLoadFile("konta.xml") 
        if not xml then return end 
        local child=xmlFindChild(xml, "konto", 0) 
        local xmlChildren=xmlNodeGetChildren(child) 
        for _,v in pairs(xmlChildren) do 
            local nick=xmlNodeGetAttribute(v, "username") 
            local passwd=xmlNodeGetAttribute(v, "haslo") 
            local money=xmlNodeGetAttribute(v, "kasa") 
            local skin=xmlNodeGetAttribute(v, "skin") 
            if nick==username and passwd==md5pass then 
                setPlayerName ( player, username) 
                executeCommandHandler ( "login "..username.." "..password.."", player ) 
                triggerClientEvent(player,"closeLoginPanel",player)  
                setPlayerMoney(player, tonumber(money)) 
                SetElementModel(player, tonumber(skin)) 
                break 
            elseif nick==username and passwd~=md5pass then 
                triggerClientEvent(player,"zlehaslo",player)  
                break 
            else 
                triggerClientEvent(player,"zledane",player)  
                break 
            end 
        end 
        xmlUnloadFile(xml) 
    end 
end 
addEvent("login",true) 
addEventHandler("login",getRootElement(),LoginXD) 

z góry dziękuje oraz pozdrawiam

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...