Anubhav Posted September 7, 2014 Share Posted September 7, 2014 function getResourceMaps(resource) local scripts = {} local resourceName = tostring(resource) local theMeta = xmlLoadFile(":"..resourceName.."/meta.xml") for i, node in ipairs (xmlNodeGetChildren(theMeta)) do if (xmlNodeGetName(node) == "map") then local script = xmlNodeGetAttribute(node, "src") if (script) then table.insert(scripts, script) end end end return scripts end xmlNodeGetChildren and ipairs got boolean all time. The resourceName is "play". Link to comment
marty000123 Posted September 7, 2014 Share Posted September 7, 2014 Greetings Anubhav, I don't understand exactly what you mean, but I'll give it a try. If you don't want the ''play'' gamemode, just delete the resource ''play'', the only thing it does is spawn randomly cars everywhere on the map. (When you delete it the gamemode will turn into ''MTA:SA'') To get another gamemode name? You need to do that with a meta.xml file. Example, "Marty" type="gamemode" name="" /> In case you know this already, I'm sorry I didn't understand your question. In that case, please re-phrase your question and I will try to help you. Marty Link to comment
Anubhav Posted September 7, 2014 Author Share Posted September 7, 2014 Still same error. I meant that when I use that function it gives error. The ipair and node thingy gets boolean. Link to comment
tosfera Posted September 7, 2014 Share Posted September 7, 2014 You should add a check above your loop, because theMeta can be false. If it's false, it won't do anything. Make a small check like this; if ( not theMeta ) then return end It should skip any files which failed to load. Link to comment
Anubhav Posted September 7, 2014 Author Share Posted September 7, 2014 I fixed it myself thanks for help. 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