Skip to main content

getEntitiesInRange

Callable

  • getEntitiesInRange(position: IVector3, range: number, dimension: number, allowedTypes: BaseObjectFilterType): readonly Entity[]

  • Returns all entities of the specified type (or types) at the specified position, in the given range and dimension.

    Example

    // Returns all players and vehicles in a range equal to 3 and dimension equal to 0
    const playersAndVehicles = alt.getEntitiesInRange(
    alt.Vector3.zero, // position
    3.0, // range
    0, // dimension
    alt.BaseObjectFilterType.Player | alt.BaseObjectFilterType.Vehicle,
    );

    // Returns players in a range equal to 3 and dimension equal to 0
    const players = alt.getEntitiesInRange(
    alt.Vector3.zero, // position
    3.0, // range
    0, // dimension
    alt.BaseObjectFilterType.Player,
    );