damien111 Posted July 8, 2014 Share Posted July 8, 2014 I cant get a gridlist to load the table i get from this. XML <homes> <houses> <house dim="3" interior="0" num="3" x="2337.2685546875" y="-1201.740234375" z="27.9765625" lx="2334.7817382813" ly="-1203.9139404297" lz="27.9765625" cost="500" owner="" street="Ballz" sellprice="600" lockStatus="unlock"></house> </houses> <interiors> <interior num="0" id="3" x="2496.02" y="-1692.10" z="1014.74" /> <interior num="1" id="1" x="223.22" y="1287.27" z="1082.14" /> <interior num="2" id="4" x="260.98" y="1284.55" z="1080.25" /> <interior num="3" id="5" x="140.21" y="1366.91" z="1083.85" /> <interior num="4" id="9" x="82.94" y="1322.44" z="1083.86" /> <interior num="5" id="15" x="-283.85" y="1470.96" z="1084.375" /> <interior num="6" id="4" x="-260.60" y="1456.62" z="1084.37" /> <interior num="7" id="8" x="-42.78" y="1405.75" z="1084.43" /> <interior num="8" id="6" x="-68.69" y="1351.97" z="1080.21" /> <interior num="9" id="6" x="2333.05" y="-1077.14" z="1049.02" /> <interior num="10" id="5" x="2233.77" y="-1115.03" z="1050.88" /> <interior num="11" id="8" x="2365.30" y="-1134.92" z="1050.875" /> <interior num="12" id="11" x="2282.91" y="-1140.29" z="1050.90" /> <interior num="13" id="6" x="2196.79" y="-1204.35" z="1049.02" /> <interior num="14" id="10" x="2270.38" y="-1210.45" z="1047.56" /> <interior num="15" id="6" x="2308.79" y="-1212.88" z="1049.02" /> <interior num="16" id="1" x="2218.39" y="-1076.25" z="1050.48" /> <interior num="17" id="2" x="2237.52" y="-1081.64" z="1049.02" /> <interior num="18" id="9" x="2317.84" y="-1026.76" z="1050.21" /> <interior num="19" id="5" x="318.60" y="1114.48" z="1083.88" /> <interior num="20" id="5" x="1298.85" y="-797.01" z="1084.01" /> <interior num="21" id="1" x="-794.99" y="489.29" z="1376.20" /> <interior num="22" id="18" x="1727.04" y="-1637.84" z="20.22" /> <interior num="23" id="18" x="-31.03515625" y="-91.6103515625" z="1003.546875" /> <interior num="24" id="6" x="-26.689453125" y="-57.8095703125" z="1003.546875" /> <interior num="25" id="15" x="2215.04296875" y="-1150.5546875" z="1025.796875" /> </interiors> </homes> Script Snippet local account = getPlayerAccount(player) rootNode = xmlLoadFile (":LGChousing/homes.xml") housesNode = xmlFindChild (rootNode,"houses",0) houseNodes = xmlNodeGetChildren (housesNode) houses = {} for i,v in ipairs(houseNodes)do houseTable = xmlNodeGetAttributes ( v ) for i,v in ipairs(houseTable)do local owner = xmlNodeGetAttribute (v,"owner") local street = xmlNodeGetAttribute (v,"street") local x = xmlNodeGetAttribute (v,"x") local y = xmlNodeGetAttribute (v,"y") local z = xmlNodeGetAttribute (v,"z") if(owner==getAccountName(account))then index = #houseTable houses[index][1] = street houses[index][2] = x houses[index][3] = y houses[index][4] = z end end end triggerClientEvent(player, "showSpawn", player, houses) Link to comment
MTA Team botder Posted July 9, 2014 MTA Team Share Posted July 9, 2014 houseTable = xmlNodeGetAttributes ( v ) for i,v in ipairs(houseTable)do local owner = xmlNodeGetAttribute (v,"owner") local street = xmlNodeGetAttribute (v,"street") local x = xmlNodeGetAttribute (v,"x") local y = xmlNodeGetAttribute (v,"y") local z = xmlNodeGetAttribute (v,"z") if(owner==getAccountName(account))then index = #houseTable houses[index][1] = street houses[index][2] = x houses[index][3] = y houses[index][4] = z end To get the attribute values you have to use the attributeName as index in houseTable: local owner = houseTable["owner"] or false local street = houseTable["street"] or "Noname Street" 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