Pool::forEachInStreamRange
Jump to navigation
Jump to search
This function is used for calling a function for each element that is in a client's streaming range in a pool.
Syntax
pool.forEachInStreamRange(Function callingFunction);
Required Arguments
- callingFunction: Function, what will be called.
Example #1
This example will generate text with all player nicknames within the client's streaming range.
Client-Side
let getNicknamesText = () => {
let text = ``;
mp.players.forEachInStreamRange(
(player, id) => {
text = text == `` ? player.name : `${text} , ${player.name}`;
}
);
return text;
};
let blahBlah = getNicknamesText();
console.log(blahBlah != `` ? blahBlah : `There are no players in your streaming range.`);