Skip to main content

Object::getAllInRange

Not available on SYNC MP yet

This member is part of the RAGE:MP API but SYNC MP does not implement it yet (Client-side JavaScript). Calling it does nothing or throws.

Getting object info and details from range

Client-Side

mp.game.object.getAllInRange(position: Vector3, range?: number, includeDistance?: boolean, sortByDistance?: boolean)

Arguments​

  • position: Vector3
  • range: Number
  • includeDistance: Boolean
  • sortByDistance: Boolean

Example​

const objectsInRange = mp.game.object.getAllInRange(mp.players.local.position,5, true);
if(objectsInRange && objectsInRange.length > 0) {
objectsInRange.forEach((object) => {
const color = [255, 255, 255, 255];
mp.game.graphics.drawText(`${object[0]}`, [object[1].x, object[1].y, object[1].z],{color, font: 4, scale: [0.35, 0.35], outline: true});
});
}

Return Value​

  • Array of Array Object