From 5855010643f7ab0c8571cea3d6b5b1cbde4c72d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 3 Aug 2017 13:17:17 +0200 Subject: [PATCH] Add distance check --- client/main.lua | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/client/main.lua b/client/main.lua index 850ebb67..ca18a59a 100644 --- a/client/main.lua +++ b/client/main.lua @@ -141,13 +141,15 @@ function OpenShopMenu() if IsAnyVehicleNearPoint(Config.Zones.ShopInside.Pos.x, Config.Zones.ShopInside.Pos.y, Config.Zones.ShopInside.Pos.z, 3.0) then - local vehicle = ESX.Game.GetClosestVehicle({ + local vehicle, distance = ESX.Game.GetClosestVehicle({ x = Config.Zones.ShopInside.Pos.x, y = Config.Zones.ShopInside.Pos.y, z = Config.Zones.ShopInside.Pos.z }) - - DeleteVehicle(vehicle) + + if distance <= 3.0 then + DeleteVehicle(vehicle) + end end @@ -201,13 +203,15 @@ function OpenShopMenu() if IsAnyVehicleNearPoint(Config.Zones.ShopInside.Pos.x, Config.Zones.ShopInside.Pos.y, Config.Zones.ShopInside.Pos.z, 3.0) then - local vehicle = ESX.Game.GetClosestVehicle({ + local vehicle, distance = ESX.Game.GetClosestVehicle({ x = Config.Zones.ShopInside.Pos.x, y = Config.Zones.ShopInside.Pos.y, z = Config.Zones.ShopInside.Pos.z }) - - DeleteVehicle(vehicle) + + if distance <= 3.0 then + DeleteVehicle(vehicle) + end end @@ -228,13 +232,15 @@ function OpenShopMenu() if IsAnyVehicleNearPoint(Config.Zones.ShopInside.Pos.x, Config.Zones.ShopInside.Pos.y, Config.Zones.ShopInside.Pos.z, 3.0) then - local vehicle = ESX.Game.GetClosestVehicle({ + local vehicle, distance = ESX.Game.GetClosestVehicle({ x = Config.Zones.ShopInside.Pos.x, y = Config.Zones.ShopInside.Pos.y, z = Config.Zones.ShopInside.Pos.z }) - - DeleteVehicle(vehicle) + + if distance <= 3.0 then + DeleteVehicle(vehicle) + end end @@ -253,13 +259,15 @@ function OpenShopMenu() if IsAnyVehicleNearPoint(Config.Zones.ShopInside.Pos.x, Config.Zones.ShopInside.Pos.y, Config.Zones.ShopInside.Pos.z, 3.0) then - local vehicle = ESX.Game.GetClosestVehicle({ + local vehicle, distance = ESX.Game.GetClosestVehicle({ x = Config.Zones.ShopInside.Pos.x, y = Config.Zones.ShopInside.Pos.y, z = Config.Zones.ShopInside.Pos.z }) - - DeleteVehicle(vehicle) + + if distance <= 3.0 then + DeleteVehicle(vehicle) + end end