Difference between revisions of "AddResourceMap"

From Multi Theft Auto: Wiki
m
 
Line 2: Line 2:
 
__NOTOC__
 
__NOTOC__
 
This function adds a new empty mapfile to an existing resource.
 
This function adds a new empty mapfile to an existing resource.
 
+
{{Note| You can't add a map to a running resource.}}
  
 
==Syntax==  
 
==Syntax==  
Line 13: Line 13:
 
:For example, if you want to create a map file named 'manycars.map' in the resource 'cdm', it can be created from another resource this way: ''addResourceMap(":cdm/manycars.map")''.
 
:For example, if you want to create a map file named 'manycars.map' in the resource 'cdm', it can be created from another resource this way: ''addResourceMap(":cdm/manycars.map")''.
 
:If you want to create the map file in the current resource, only the file path is necessary, e.g. ''addResourceMap("manycars.map")''.
 
:If you want to create the map file in the current resource, only the file path is necessary, e.g. ''addResourceMap("manycars.map")''.
 
'''NOTE:''' You can't add a map to a running resource.
 
  
 
===Optional Arguments===  
 
===Optional Arguments===  

Latest revision as of 05:04, 11 August 2019

This function adds a new empty mapfile to an existing resource.

[[{{{image}}}|link=]] Note: You can't add a map to a running resource.

Syntax

xmlnode addResourceMap ( string filePath, [ int dimension = 0 ] )

Required Arguments

  • filePath: The filepath of the resource map in the following format: ":resourceName/path". 'resourceName' is the name of the resource the map file will be in, and 'path' is the path from the root directory of the resource to the file.
For example, if you want to create a map file named 'manycars.map' in the resource 'cdm', it can be created from another resource this way: addResourceMap(":cdm/manycars.map").
If you want to create the map file in the current resource, only the file path is necessary, e.g. addResourceMap("manycars.map").

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • dimension: the dimension in which the map's objects will be placed.

Returns

Returns the new map's root xmlnode if the map was added successfully, false otherwise.

Example

This example just adds a map to a gamemode resource called "cdm".

addResourceMap(":cdm/[maps]/New.map",0)

See Also