- Documentation
- Server functions
- getResourceMapRootElement
Function
getResourceMapRootElement
Returns the element of a map loaded from the resource's .map file; its children are the objects, vehicles and other elements from that map.
Syntax
element getResourceMapRootElement(resource theResource [, string mapName])Arguments
theResourceresource- The resource.
mapNamestring, optional- The map file name; the first map without it.
Returns
The map element or false.
Example
local map = getResourceMapRootElement(getThisResource(), "trasa.map")
if map then
outputServerLog(#getElementsByType("object", map) .. " obiektów na mapie")
end
Notes
MTA format. MTA:SA .map files work unchanged: objects, vehicles, NPCs, markers, pickups, blips, water (an element for scripts, like createWater), radar areas, <removeWorldObject> and custom elements (e.g. spawnpoint). Attributes from the file are also element data on the server (getElementData(obj, "posX")).