Pool::size: Difference between revisions

From RAGE Multiplayer Wiki
m (category)
No edit summary
 
Line 1: Line 1:
{{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]]).
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'''
'''Note: This property is read only'''


== Getter ==
{{Pool_list}}
 
 
 
==Return Value==
* {{RageType|Number}} - Size of pool
* {{RageType|Number}} - Size of pool


== Example ==
== Example ==
<pre>
// todo
</pre>


<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:TODO: Example]]
[[Category:Server-side Property]]
[[Category:Server-side Property]]
[[Category:Client-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