mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
Fix duplicate vehicles in garage
This commit is contained in:
+18
-2
@@ -56,8 +56,6 @@ AddEventHandler('esx_property:hasEnteredMarker', function(name, part, parking)
|
||||
|
||||
ESX.TriggerServerCallback('esx_vehicleshop:getVehiclesInGarage', function(vehicles)
|
||||
|
||||
print('')
|
||||
|
||||
for i=1, #garage.Parkings, 1 do
|
||||
for j=1, #vehicles, 1 do
|
||||
|
||||
@@ -65,6 +63,12 @@ AddEventHandler('esx_property:hasEnteredMarker', function(name, part, parking)
|
||||
|
||||
local spawn = function(j)
|
||||
|
||||
local vehicle = GetClosestVehicle(garage.Parkings[i].Pos.x, garage.Parkings[i].Pos.garage.Parkings[i].Pos.y, garage.Parkings[i].Pos.z, 2.0, 0, 71)
|
||||
|
||||
if DoesEntityExist(vehicle) then
|
||||
ESX.Game.DeleteVehicle(vehicle)
|
||||
end
|
||||
|
||||
ESX.Game.SpawnLocalVehicle(vehicles[j].vehicle.model, {
|
||||
x = garage.Parkings[i].Pos.x,
|
||||
y = garage.Parkings[i].Pos.y,
|
||||
@@ -105,6 +109,12 @@ AddEventHandler('esx_property:hasEnteredMarker', function(name, part, parking)
|
||||
|
||||
local spawn = function(j)
|
||||
|
||||
local vehicle = GetClosestVehicle(garage.Parkings[i].Pos.x, garage.Parkings[i].Pos.garage.Parkings[i].Pos.y, garage.Parkings[i].Pos.z, 2.0, 0, 71)
|
||||
|
||||
if DoesEntityExist(vehicle) then
|
||||
ESX.Game.DeleteVehicle(vehicle)
|
||||
end
|
||||
|
||||
ESX.Game.SpawnLocalVehicle(vehicles[j].vehicle.model, {
|
||||
x = garage.Parkings[i].Pos.x,
|
||||
y = garage.Parkings[i].Pos.y,
|
||||
@@ -148,6 +158,12 @@ AddEventHandler('esx_property:hasEnteredMarker', function(name, part, parking)
|
||||
|
||||
local spawn = function(j)
|
||||
|
||||
local vehicle = GetClosestVehicle(garage.Parkings[i].Pos.x, garage.Parkings[i].Pos.y, garage.Parkings[i].Pos.z, 2.0, 0, 71)
|
||||
|
||||
if DoesEntityExist(vehicle) then
|
||||
ESX.Game.DeleteVehicle(vehicle)
|
||||
end
|
||||
|
||||
ESX.Game.SpawnLocalVehicle(vehicles[j].vehicle.model, {
|
||||
x = garage.Parkings[i].Pos.x,
|
||||
y = garage.Parkings[i].Pos.y,
|
||||
|
||||
Reference in New Issue
Block a user