Hi there, For the script esx_jb_eden_garage2, I want it to be deleted if you remove it from the car if it exists in the earth. Can you help me?
Look at this:
function(data, menu)
if data.current.value == 'fourrieremecano' then
ESX.ShowNotification("Va voir la police ou mecano pour savoir comment recuperer ton véhicule.")
elseif data.current.value ~= nil then
local iscaronearth = false
for k,v in pairs (carInstance) do
if ESX.Math.Trim(v.plate) == ESX.Math.Trim(data.current.value.plate) then
if DoesEntityExist(v.vehicleentity) then
iscaronearth = true
else
table.remove(carInstance, k)
iscaronearth = false
end
end
end
if not iscaronearth then
ESX.TriggerServerCallback('eden_garage:checkMoney', function(hasEnoughMoney)
if hasEnoughMoney then
menu.close()
SpawnVehicle(data.current.value, garage, KindOfVehicle)
else
ESX.ShowNotification('Vous n\'avez pas assez d\'argent')
end
end)
else
ESX.ShowNotification("Vous ne pouvez pas sortir ce véhicule. Allez la chercher!")
end
end
There should be a “delete this car” code instead of ESX.ShowNotification(“Vous ne pouvez pas sortir ce véhicule. Allez la chercher!”)