Pool::length: Difference between revisions

From RAGE Multiplayer Wiki
(Fixed bad English, updated example border)
No edit summary
Line 5: Line 5:
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
int pool.length;
Number pool.length;
</syntaxhighlight>
</syntaxhighlight>



Revision as of 14:56, 26 September 2017

This property is used to get the element count of a pool.

Note: this property is read-only.

Syntax

Number pool.length;

Example

This example will return vehicles and players count.

Server-Side
let getStuffCount = () => {
	return [mp.players.length, mp.vehicles.length];
};

let [players, vehicles] = getStuffCount();
console.log(`Server have ${vehicles} vehicles and ${players} players.`)

See Also