Pool::getClosest
Server-Side Function
JavaScript |
---|
Sorts the closest entities to a certain specified point in the entities pool.
JavaScript Syntax
Syntax
mp.Pool.getClosest(pos, limit)
Required Arguments
- *pos: Array ([x, y, z])
- limit: Int (Default is 1)
Example
Server-Side
let player = mp.players.getClosest([0,0,0]); console.log(player.id); let players = mp.players.getClosest([0,0,0], 2); console.log(players[0].id); let allPlayersSortedByDistanceToPoint = mp.players.getClosest([0,0,0], mp.players.length);
See Also
- Functions
- Properties
- Arrays