- Documentation
- Client functions
- setSoundSpeed
Function
setSoundSpeed
Sets the playback speed. 1 is normal; a higher value speeds up and raises the pitch.
Syntax
bool setSoundSpeed(sound theSound, float speed)Arguments
theSoundsound- The sound.
speedfloat- Speed greater than 0.
Returns
true on success.
Example
local engine = playSound("audio/engine.wav", true)
addEventHandler("onClientRender", root, function()
local veh = getPedOccupiedVehicle(localPlayer)
if veh then
local vx, vy, vz = getElementVelocity(veh)
setSoundSpeed(engine, 0.8 + math.sqrt(vx * vx + vy * vy) * 2)
end
end)