Search the Community
Showing results for tags 'engine sound'.
-
Well the script is almost perfect! . Just missing the part of synchrony in the gearshift, someone to help me? function updateEngineSound() local allVehicles = getElementsByType("vehicle") for index, veh in ipairs (allVehicles) do local model = getElementModel(veh) if model == 411 then if getVehicleEngineState(veh) then local x, y, z = getElementPosition(veh) local sound = getElementData(veh, "engineSound") if not sound then sound = playSound3D("sounds/engine.wav", x, y, z, true) setElementData(veh, "engineSound", sound,false) end if isSoundPaused(veh) then setSoundPaused(sound, false) end local gear = getVehicleCurrentGear ( veh ) or 1 local velocityX, velocityY, velocityZ = getElementVelocity(veh) local actualspeed = ((velocityX^2 + velocityY^2 + velocityZ^2)^(0.5)) * ((11 - gear) /10) local mph = actualspeed * 70 * 111.847 local minSoundSpeed = 0.15 local soundSpeed = mph/(1000+1000/minSoundSpeed) + minSoundSpeed setSoundSpeed (sound, soundSpeed) setElementPosition(sound, x, y, z) else setSoundPaused(sound, true) end end end end addEventHandler ("onClientPreRender", root, updateEngineSound)