ReturnVehicle = { }
function spawnCar ( )
if not isPedInVehicle ( source ) and not ReturnVehicle [ source ] and not isElement ( ReturnVehicle [ source ] ) then
local x, y, z = getElementPosition ( source )
ReturnVehicle [ source ] = createVehicle ( 587, x, y, z )
if ReturnVehicle [ source ] and isElement ( ReturnVehicle [ source ] ) then
setVehicleColor ( ReturnVehicle [ source ],20,20,20,30,30,30 )
warpPedIntoVehicle ( source,ReturnVehicle [ source ] )
setVehicleHeadLightColor( ReturnVehicle [ source ],0,0,255 )
addVehicleSirens ( ReturnVehicle [ source ],1,2 )
setVehicleSirens ( ReturnVehicle [ source ],1,0,0.7,0.35,255,0,255 )
end
end
end
addEvent("vehicleSpawn",true)
addEventHandler("vehicleSpawn",getRootElement(),spawnCar)
addEventHandler('onVehicleExplode',root,
function ( )
if source == ReturnVehicle [ source ] and isElement ( ReturnVehicle [ source ] ) then
destroyElement ( ReturnVehicle [ source ] )
ReturnVehicle [ source ] = nil
end
end
)