ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. setSoundSpeed

Function

setSoundSpeed

ClientSound (client)Identical to MTA:SA

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)

See also