Pool::size: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with "{{Incomplete Functions}}")
 
No edit summary
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Incomplete Functions}}
{{SharedJsFunction}}
{{JSContainer|
 
==Summary==
A property to get an element pool size, useful to be used in explicit array size declaration or manual for loop size (non [[Pool::forEach|foreach]]).
 
'''Note: This property is read only'''
 
{{Pool_list}}
 
 
 
==Return Value==
* {{RageType|Number}} - Size of pool
 
== Example ==
 
<syntaxhighlight lang="javascript">
// Example of using the size property
let vehicleCount = mp.vehicles.size;
console.log(`There are ${vehicleCount} vehicles on the server.`);
</syntaxhighlight>
 
}}
===See also===
{{EntityPool_function}}
 
[[Category:Server-side Property]]
[[Category:Client-side Property]]

Latest revision as of 12:26, 10 November 2024

Shared
Function

 JavaScript


JavaScript Syntax


Summary

A property to get an element pool size, useful to be used in explicit array size declaration or manual for loop size (non foreach).

Note: This property is read only

Available Entity Pools

The following are the main entity pools available on the RAGEMP, used for managing various game entities:

Entity Pool Description
mp.players Manages all connected players
mp.vehicles Manages all spawned vehicles
mp.objects Manages all created objects
mp.peds Manages all non-player characters (peds)
mp.markers Manages all markers in the game
mp.labels Manages all 3D text labels
mp.checkpoints Manages checkpoints
mp.blips Manages map blips
mp.colshapes Manages collision shapes


Return Value

  • Number - Size of pool

Example

// Example of using the size property
let vehicleCount = mp.vehicles.size;
console.log(`There are ${vehicleCount} vehicles on the server.`);



See also