Pool::length: Difference between revisions
No edit summary |
No edit summary |
||
| Line 12: | Line 12: | ||
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;"> | <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> | <div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div> | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript" highlight="2"> | ||
let getStuffCount = () => { | let getStuffCount = () => { | ||
return [mp.players.length, mp.vehicles.length]; | return [mp.players.length, mp.vehicles.length]; | ||
Revision as of 15:23, 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
- Functions
- Properties
- Arrays