Pool::forEachInDimension: Difference between revisions
(Fix) |
m (Replaced HTML with template) |
||
| Line 2: | Line 2: | ||
==Syntax== | ==Syntax== | ||
< | <pre> | ||
void pool.forEachInDimension(int dimension, function callingFunction); | void pool.forEachInDimension(int dimension, function callingFunction); | ||
</ | </pre> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''Dimension:''' Int, dimension | *'''Dimension:''' Int, dimension | ||
| Line 11: | Line 12: | ||
==Example== | ==Example== | ||
This example will print the names of players in dimension 0 to the server console. (Dimension 0 is the default dimension) | This example will print the names of players in dimension 0 to the server console. (Dimension 0 is the default dimension) | ||
{{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}} | ||
Revision as of 12:13, 26 October 2018
This function is used to call a function for each elements in the pool.
Syntax
void pool.forEachInDimension(int dimension, function callingFunction);
Required Arguments
- Dimension: Int, dimension
- callingFunction: Function, what will be called.
Example
This example will print the names of players in dimension 0 to the server console. (Dimension 0 is the default dimension)
Server-Side
mp.players.forEachInDimension(0, (player, id) => {
console.log("Player: " + player.name);
});
See Also
- Functions
- Properties
- Arrays