Pool::forEachInDimension: Difference between revisions
(Initial description) |
No edit summary |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{ServersideJsFunction}} | |||
{{JSContainer| | |||
{{Pool_list}} | |||
==Syntax== | ==Syntax== | ||
< | <pre> | ||
void pool.forEachInDimension(int dimension, function callingFunction); | void pool.forEachInDimension(int dimension, function callingFunction); | ||
</ | </pre> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''dimension:''' {{RageType|int}} The dimension in which to apply the function. | ||
*'''callingFunction:''' | *'''callingFunction:''' The function to be called for each entity in the specified dimension. | ||
==Example== | |||
This example outputs the names of all players in dimension 0 (default dimension) to the server console. | |||
{{ServersideCode| | |||
<pre> | |||
< | |||
mp.players.forEachInDimension(0, (player, id) => { | mp.players.forEachInDimension(0, (player, id) => { | ||
console.log("Player: " + player.name); | console.log("Player: " + player.name); | ||
}); | }); | ||
</ | </pre> | ||
}} | |||
}} | |||
==See Also== | ==See Also== | ||
{{EntityPool_function}} | {{EntityPool_function}} | ||
Latest revision as of 12:13, 10 November 2024
Server-Side Function
JavaScript Syntax
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 |
Syntax
void pool.forEachInDimension(int dimension, function callingFunction);
Required Arguments
- dimension: int The dimension in which to apply the function.
- callingFunction: The function to be called for each entity in the specified dimension.
Example
This example outputs the names of all players in dimension 0 (default dimension) to the server console.
Server-Side
mp.players.forEachInDimension(0, (player, id) => {
console.log("Player: " + player.name);
});
See Also
- Functions
- Properties
- Arrays