I can't verify if the vehicle's id is the same as the spawned one and if it's going to destroy it!
addEvent('onPlayerRequestSpawnV', true)
addEventHandler('onPlayerRequestSpawnV', root, function(vid)
local x,y,z = getElementPosition(source);
local _,_,r = getElementRotation(source);
local spawnedV = getElementData(source, 'conce.garagem.spawneds') or {};
for i,v in ipairs(spawnedV) do
if i.vidC == vid then
if i.vh and isElement(i.vh) then
destroyElement(i.vh)
return false;
end
end
end
vehicleSV = createVehicle(vid, x,y,z,_,_,r)
warpPedIntoVehicle(source, vehicleSV)
table.insert(spawnedV, {vidC = vid, vh = vehicleSV})
end);
This is my current code...