- Documentation
- Server functions
- loadMapData
Function
loadMapData
Creates elements (vehicles, objects, markers, pickups...) from an XML map node in .map format. Returns the map root element; destroying it removes the whole map.
Syntax
element loadMapData(xmlnode node, element parent)Arguments
nodexmlnode- The XML node with the map.
parentelement- The parent for the map.
Returns
The map root or false.
Example
local xml = xmlLoadFile("maps/stadion.map")
local map = loadMapData(xml, resourceRoot)
xmlUnloadFile(xml)
addCommandHandler("usunmape", function()
destroyElement(map)
end)
See also
saveMapDataSaves the elements under a given element to an XML node in.mapformat.xmlLoadFileLoads an XML file and returns its root node, from which you can read children and attributes. On the server the path is relative to the resource folder (you cannot leave it). On the client it reads the script's own files and then<file>files sent by the server; a":other/file.xml"path points to another resource's file. RememberxmlUnloadFilewhen the document is no longer needed.