Pool::length: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
(Fixed bad English, updated example border)
Line 1: Line 1:
This property used for get pool elements count.
This property is used to get the element count of a pool.


'''Note: this property is read-only.'''
'''Note: this property is read-only.'''
Line 6: Line 6:
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
int pool.length;
int pool.length;
</syntaxhighlight>  
</syntaxhighlight>


==Example==  
==Example==  
That's example will return vehicles and players count.
This example will return vehicles and players count.
 
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;">
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
let getStuffCount = () => {
let getStuffCount = () => {
Line 19: Line 20:
console.log(`Server have ${vehicles} vehicles and ${players} players.`)
console.log(`Server have ${vehicles} vehicles and ${players} players.`)
</syntaxhighlight>
</syntaxhighlight>
</div>


==See Also==
==See Also==
{{EntityPool_function}}
{{EntityPool_function}}

Revision as of 09:59, 20 September 2017

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

Note: this property is read-only.

Syntax

int 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