Перейти к содержанию

Testpage

Материал из RAGE MP Wiki Archive
Версия от 05:32, 27 сентября 2017; imported>SalwadoR (Created page with "__NOTOC__{{DISPLAYTITLE:<span style="display:none">{{FULLPAGENAME}}</span>}} This function is used for check, exists entity with ID in pool or not. ==Syntax== <syntaxhighligh...")
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

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

Syntax

<syntaxhighlight lang="javascript"> Boolean pool.exists(Number ID) </syntaxhighlight>

Returns

Return true if entity exists, false if not exists.

Required Arguments

  • ID: Entity ID, 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

<syntaxhighlight lang="javascript" highlight="1"> 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...`); }; </syntaxhighlight>

See Also