Start using data indexes for IV instead of object
This commit is contained in:
@@ -1128,8 +1128,8 @@ function getClosestCivilian(position) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getVehiclesInRange(position, range) {
|
function getVehiclesInRange(position, range) {
|
||||||
if (getGame() == AGRP_GAME_GTA_IV) {
|
if (!areServerElementsSupported()) {
|
||||||
return getServerData().vehicles.reduce((i, j) => (getDistance(position, i.syncPosition) <= getDistance(position, j.syncPosition)) ? i : j);
|
return getServerData().vehicles.filter(x => getDistance(position, x.syncPosition) <= distance);
|
||||||
}
|
}
|
||||||
return getElementsByTypeInRange(ELEMENT_VEHICLE, position, range);
|
return getElementsByTypeInRange(ELEMENT_VEHICLE, position, range);
|
||||||
}
|
}
|
||||||
@@ -1137,6 +1137,9 @@ function getVehiclesInRange(position, range) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getClosestVehicle(position) {
|
function getClosestVehicle(position) {
|
||||||
|
if (!areServerElementsSupported()) {
|
||||||
|
getServerData().vehicles.reduce((i, j) => (getDistance(position, i.syncPosition) <= getDistance(position, j.syncPosition)) ? i : j);
|
||||||
|
}
|
||||||
return getClosestElementByType(ELEMENT_VEHICLE, position);
|
return getClosestElementByType(ELEMENT_VEHICLE, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user