Jump to content

Error with meta.xml while generating map on new resource


12p

Recommended Posts

This script works fine:

function createMap () 
    if not getResourceFromName("minecraftmap") then 
     mapResource = createResource ("minecraftmap") 
    end 
    mapFile = addResourceMap (":minecraftmap/map.map") 
    return mapFile 
end 

The only problem is that meta.xml can't find the map when it is created... So I tried to do this:

function createMap () 
    if not getResourceFromName("minecraftmap") then 
     mapResource = createResource ("minecraftmap") 
    end 
    mapFile = addResourceMap (":minecraftmap/map.map") 
    removeResourceFile (mapResource,"meta.xml") 
    local meta = xmlCreateFile (":minecraftmap/meta.xml","meta") 
    local mapNode = xmlCreateChild (meta,"map") 
    xmlNodeSetAttribute (mapNode,"src","map.map") 
    xmlNodeSetAttribute (mapNode,"dimension","0") 
    return mapFile 
end 

But nothing happens. Maybe it's a bug of MTA?

PS: This is meta.xml looking when I create the map:

<meta> 
    <map src="" dimension="0" /> 
</meta> 

PS2: Can u believe this is the first time I use XML functions and map functions?

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...