TheIceman1 Posted April 10, 2013 Share Posted April 10, 2013 Zkj mi neče izbrisat clan iz "clans.xml"? function destroyclan () local clan = getElementData ( source, "clan" ) removeElementData ( source, "clan" ) local clans = xmlLoadFile ("clans.xml") local clansroot = xmlFindChild (clans,"clans",0) if ( clansroot ) then for i,v in ipairs (xmlNodeGetChildren(clansroot)) do local xmlnumber = xmlNodeGetAttribute (v,"clan") xmlDestroyNode ( v ) xmlSaveFile ( clans ) xmlUnloadFile ( clans ) end end end addEvent ( "destroyclan", true ) addEventHandler ( "destroyclan", root, destroyclan ) XML "FBI"> Link to comment
Mega9 Posted April 11, 2013 Share Posted April 11, 2013 xmlLoadFile already returns pointer to the root of the xml file, so you don't need to search 'clans' node again with xmlFindChild. Try to comment the 5th line and rename 'clans' variable to 'clansroot' in the 4th line and see if that helps. ^ Prateći te upute, dobiješ ovo: function destroyclan () local clan = getElementData ( source, "clan" ) removeElementData ( source, "clan" ) local clansroot = xmlLoadFile ("clans.xml") -- local clansroot = xmlFindChild (clans,"clans",0) if ( clansroot ) then for i,v in ipairs (xmlNodeGetChildren(clansroot)) do local xmlnumber = xmlNodeGetAttribute (v,"clan") xmlDestroyNode ( v ) xmlSaveFile ( clans ) xmlUnloadFile ( clans ) end end end addEvent ( "destroyclan", true ) addEventHandler ( "destroyclan", root, destroyclan ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now