CreateElement: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:


===Required Arguments===
===Required Arguments===
*'''type:''' The type of element being created. This value will be returned if getElementType is used on it. Note: The type cannot be a hard-coded MTA element or "dummy".
*'''type:''' The type of element being created. This value will be returned if getElementType is used on it.
*'''name:''' The ID of the element being created.
*'''name:''' The ID of the element being created.


===Returns===
===Returns===
Returns ''true'' if the element was successfully created. Returns ''false'' otherwise.
Returns ''true'' if the element was successfully created. Returns ''false'' if the arguments are wrong or if the type is not allowed. Unallowed types include hard-coded MTA elements (such as "vehicle") and the type "dummy".


==Example==
==Example==

Revision as of 20:40, 7 October 2006

This function is used to create dummy elements in the element table, but do not have a counterpart within the San Andreas world. A common use for this function is for creating group or team elements.

Syntax

element createElement ( string type, string name )

Required Arguments

  • type: The type of element being created. This value will be returned if getElementType is used on it.
  • name: The ID of the element being created.

Returns

Returns true if the element was successfully created. Returns false if the arguments are wrong or if the type is not allowed. Unallowed types include hard-coded MTA elements (such as "vehicle") and the type "dummy".

Example

This example creates a squad element called 'Alpha', which will appear just off root on the element table:

alphahandle = createElement("Squad", "Alpha")

See Also