TheSmart Posted November 6, 2014 Posted November 6, 2014 This will replaced original sound of vehicle's Use it! setWorldSoundEnabled
-.Paradox.- Posted November 6, 2014 Posted November 6, 2014 Also use setDevelopmentMode to know what's nrg's sfx sound id and remove it using setWorldSoundEnabled and to apply it you need to create a 3D sound and attach it to the vehicle i guess attachElements playSound3D Good luck P.S: /debugscript 3 to output worlds sound after using setDevelopmentMode
TheSmart Posted November 6, 2014 Posted November 6, 2014 function updateEngineSound() local allVehicles = getElementsByType("vehicle") for index, veh in ipairs (allVehicles) do local model = getElementModel(veh) if model == 580 then ------ change the vehicle id if getVehicleEngineState(veh) then local x, y, z = getElementPosition(veh) local sound = getElementData(veh, "engineSound") sound = playSound3D("sounds/song.mp3", x, y, z, true) setElementData(veh, "engineSound", sound) end if isSoundPaused(sound) then setSoundPaused(sound, false) end local velocityX, velocityY, velocityZ = getElementVelocity(veh) local actualspeed = (velocityX^2 + velocityY^2 + velocityZ^2)^(0.5) local mph = actualspeed * 50 * 111.847 local minSoundSpeed = 0.25 local soundSpeed = mph/(80+80/minSoundSpeed) + minSoundSpeed setSoundSpeed (sound, soundSpeed) setElementPosition(sound, x, y, z) else -- otherwise (so if the engine is off) setSoundPaused(sound, true) end end end end setTimer(updateEngineSound, 5)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now