Pool::exists

From RAGE Multiplayer Wiki
Revision as of 17:22, 6 December 2020 by NoUse11 (talk | contribs)

This function is used for check, exists entity with ID in pool or not.

Attention / Увага / Предупреждение

This function is a prayer for solving problems with server crashes on 1.1 (10_ branch). Be sure to use it and check absolutely all the fucking network elements of your server, otherwise it cunt.

Syntax

Boolean pool.exists(Number ID)

Returns

Return true if entity exists, false if not exists.

Required Arguments

  • ID/Entity: Entity ID or the entity itself, what you wanna check in pool.

Example

This example will check player with ID in pool, and write player name into chat if he exists.

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

See Also