Skip to main content

Pool::at

Server-side function

Available Entity Pools​

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

Entity PoolDescription
mp.playersManages all connected players
mp.vehiclesManages all spawned vehicles
mp.objectsManages all created objects
mp.pedsManages all non-player characters (peds)
mp.markersManages all markers in the game
mp.labelsManages all 3D text labels
mp.checkpointsManages checkpoints
mp.blipsManages map blips
mp.colshapesManages collision shapes

Summary​

The pool.at function returns an entity from a specified pool by its ID. It is useful for accessing specific entities such as players, vehicles, or objects by their unique server-side ID.

Syntax​

pool.at(id)

Return value​

An entity with the selected ID from a pool, or undefined if no entity exists with that ID.

Required Arguments​

  • id: Number — The ID of the element to retrieve from the pool.

Example​

This example retrieves a player by ID and outputs their name to the console if they exist.

let player = mp.players.at(1488);
if (player) {
console.log(`Player with ID 1488 has nickname ${player.name}`);
} else {
console.log(`Player with ID 1488 does not exist...`);
}