SirniNamaz Posted October 10, 2012 Share Posted October 10, 2012 Client: function eventFiveSec() if (guiGetVisible(guiEventManager) == true) then local xmlElements = xmlLoadFile("elements.xml") guiGridListClear(grdElementsList) for i=0,149 do local xmlOldChild = xmlFindChild(xmlElements,"element",i) outputChatBox(xmlOldChild) local attrs = xmlNodeGetAttributes(xmlOldChild) outputChatBox(i) if (attrs == false) then return else local newRow = guiGridListAddRow(grdElementsList) for name,value in pairs(attrs) do outputChatBox(name .. " = " .. value) end end end xmlUnloadFile(xmlElements) end end XML: "6447187" type="weapon" item="4" x="2474.0759277344" y="-1653.5537109375" z="13.46875" left="1"> "5859401" type="weapon" item="4" x="0" y="0" z="0" left="0"> "1829493" type="weapon" item="4" x="2477.142578125" y="-1662.857421875" z="13.336080551147" left="1"> Problem: xmlOldChild is always returned as false Link to comment
TwiX! Posted October 10, 2012 Share Posted October 10, 2012 https://wiki.multitheftauto.com/wiki/XmlFindChild WIKI said: This is the 0-based index of the node you wish to find. For example, to find the 5th subnode with a particular name, you would use 4 as the index value. To find the first occurence, use 0. Link to comment
SirniNamaz Posted October 10, 2012 Author Share Posted October 10, 2012 thats why i put i=0,149 Link to comment
TwiX! Posted October 10, 2012 Share Posted October 10, 2012 and you have only 3 elements 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