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

Pool::getClosest

Материал из RAGE MP Wiki Archive

Server-Side
Function

Ошибка создания миниатюры: Не удаётся сохранить эскиз по месту назначения JavaScript



Sorts the closest entities to a certain specified point in the entities pool.

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