Pool::forEachInStreamRange

From RAGE Multiplayer Wiki
Revision as of 13:40, 26 October 2018 by Rootcause (talk | contribs) (Replaced HTML with template)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.`);

See Also