Pool::length: Difference between revisions
No edit summary |
m (Replaced HTML with template) |
||
| Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
< | <pre> | ||
Number pool.length; | Number pool.length; | ||
</ | </pre> | ||
==Example== | ==Example== | ||
This example will return vehicles and players count. | This example will return vehicles and players count. | ||
{{ServersideCode| | |||
<pre> | |||
< | |||
let getStuffCount = () => { | let getStuffCount = () => { | ||
return [mp.players.length, mp.vehicles.length]; | return [mp.players.length, mp.vehicles.length]; | ||
| Line 19: | Line 18: | ||
let [players, vehicles] = getStuffCount(); | let [players, vehicles] = getStuffCount(); | ||
console.log(`Server have ${vehicles} vehicles and ${players} players.`) | console.log(`Server have ${vehicles} vehicles and ${players} players.`) | ||
</ | </pre> | ||
}} | |||
==See Also== | ==See Also== | ||
{{EntityPool_function}} | {{EntityPool_function}} | ||
Revision as of 11:54, 26 October 2018
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