Pool::at: Difference between revisions
No edit summary |
No edit summary |
||
| Line 13: | Line 13: | ||
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;"> | <div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;"> | ||
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div> | <div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div> | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript" highlight="1"> | ||
let player = mp.players.at(1488); | let player = mp.players.at(1488); | ||
if (player) { | if (player) { | ||
Revision as of 15:19, 26 September 2017
This function is used to return an element from a pool at an ID.
Syntax
Entity pool.at(Number ID)
Returns
Return a entity with selected ID, from a pool. Or false, if entity with this ID not exists.
Required Arguments
- ID: Element ID, what you need get from the pool.
Example
This example will return a player by ID and output his name in the console.
Server-Side
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
- Functions
- Properties
- Arrays