getElementChildrenCount | Multi Theft Auto: Wiki Skip to content

getElementChildrenCount

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function returns the number of children an element has. Note that only the direct children are counted and not elements that are further down the element tree.

OOP Syntax Help! I don't understand this!

  • Method:element:getChildrenCount(...)

Syntax

int getElementChildrenCount ( element parent )
Required Arguments
  • parent: the parent element

Returns

  • int: value

Returns an int with the number of child elements, or false if the parent element does not exist.

Code Examples

shared

To get the number of children the 'team1' element has:

<team1 id="red">
<spawnpoint id="spawnpoint_0" posX="2507.8715820313" posY="2772.6071777344" posZ="10.8203125" rot="270" skin="285"/>
<spawnpoint id="spawnpoint_1" posX="2508.060546875" posY="2780.3647460938" posZ="10.8203125" rot="270" skin="285"/>
<spawnpoint id="spawnpoint_2" posX="2508.0053710938" posY="2776.2897949219" posZ="10.8203125" rot="270" skin="285"/>
<spawnpoint id="spawnpoint_3" posX="2510.6899414063" posY="2778.3745117188" posZ="10.8203125" rot="270" skin="285"/>
</team1>

See Also

Element Functions