setSoundPaused
Shared
Pauses or resumes a sound. On the server, the change is sent to every client.
bool setSoundPaused(sound sound, bool paused)
Parameters
| Name | Type | Description |
|---|---|---|
| sound | sound | The sound element. On the client a dui element also works, for the browser's sound. |
| paused | bool | true to pause, false to resume. |
Returns
true if the sound was found, false otherwise.
On the client, when the state changes, it fires onClientSoundStopped with paused or onClientSoundStarted with resumed.
Example
local music = playSound("sounds/track.mp3", true)
bindKey("m", "down", function()
setSoundPaused(music, not isSoundPaused(music))
end)