Pool::at: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
Line 11: Line 11:
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
let player = mp.players.at(1488);
let player = mp.players.at(1488);
if (!!player) {
if (player) {
console.log(`Player with id 1488 have nickname ${player.name}`);
console.log(`Player with id 1488 have nickname ${player.name}`);
} else {
} else {

Revision as of 10:02, 7 May 2017

This function used for return element from pool at ID.

Syntax

void pool.at(int ID)

Example

That's example will return player by ID and output his name in console.

let player = mp.players.at(1488);
if (player) {
	console.log(`Player with id 1488 have nickname ${player.name}`);
} else {
	console.log(`Player by id 1488 does not exists...`);
};

See Also