Pool::size

From RAGE Multiplayer Wiki
Revision as of 12:26, 10 November 2024 by Shr0x (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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