porque meu codigo não esta destruindo o veiculo quando o player que spawnou sai dele?
veiculo = {}
function spawnVeh(source)
if getPedOccupiedVehicle(source) == false then
if getElementData(source, "Eletricista") == true then
if getElementModel(source) == 11 then
veiculo[source] = createVehicle(config.veh, 2458.3537597656,-2078.1528320312,13.546875)
warpPedIntoVehicle(source, veiculo[source])
setElementRotation(veiculo[source], 0,0,180)
setVehicleLocked(veiculo[source],true)
setVehicleDamageProof(veiculo[source], true)
end
end
else
outputChatBox("você já esta em um veiculo")
end
end
addEvent("spawnCar", true)
addEventHandler("spawnCar", root, spawnVeh)
function onSair(source)
if getPedOccupiedVehicle(source) == false then
destroyElement ( veiculo[source] )
veiculo[source] = nil
end
end
addEventHandler("onPedVehicleExit", getRootElement(), onSair)