Pool::at: Difference between revisions
No edit summary |
(Updated example border) |
||
| Line 1: | Line 1: | ||
This function used | This function is used to return an element from a pool at an ID. | ||
==Syntax== | ==Syntax== | ||
| Line 7: | Line 7: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''ID:''' Element ID, what need get from pool. | *'''ID:''' Element ID, what you need get from the pool. | ||
==Example== | ==Example== | ||
This example will return a player by ID and output his name in the console. | |||
<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> | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
let player = mp.players.at(1488); | let player = mp.players.at(1488); | ||
| Line 20: | Line 22: | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | |||
==See Also== | ==See Also== | ||
{{EntityPool_function}} | {{EntityPool_function}} | ||
Revision as of 10:10, 20 September 2017
This function is used to return an element from a pool at an ID.
Syntax
void pool.at(int ID)
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