Fix duplicate vehicles in garage

This commit is contained in:
Jérémie N'gadi
2017-08-23 15:53:01 +02:00
parent e14306304e
commit 3b45b10441
+18 -2
View File
@@ -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,