setSoundPaused
Client-side
Server-side
Shared
Pair: isSoundPaused
This function is used to either pause or unpause the playback of the specified sound element. Use a player element to control a players voice with this function.
OOP Syntax Help! I don't understand this!
- Method: sound:setPaused(...)
- Variable: .paused
Syntax
bool setSoundPaused ( sound/player theSound, bool paused )
Required Arguments
- theSound: The sound element which you want to pause/unpause.
- paused: A boolean value representing whether the sound should be paused or not. To pause the sound, use true.
Returns
- bool: result
Returns true if the sound element was successfully paused, false otherwise.
Code Examples
client
This example will allow the user to toggle sounds from paused to playing, and from playing to paused
local theSound = playSound("music/song.mp3", true)function togglePausedSound() if(isSoundPaused(theSound)) then --sound is paused, un-pause it setSoundPaused(theSound, false) else --sound is not paused, pause it setSoundPaused(theSound, true) endendaddCommandHandler("pausesound", togglePausedSound)
Changelog
See Also
Audio Functions
- getRadioChannelName
- getRadioChannel
- getSoundBPM
- getSFXStatus
- getSoundBufferLength
- getSoundEffectParameters
- getSoundEffects
- getSoundFFTData
- getSoundLevelData
- getSoundLength
- getSoundMetaTags
- getSoundMaxDistance
- getSoundMinDistance
- getSoundPan
- getSoundPosition
- getSoundProperties
- getSoundSpeed
- getSoundVolume
- getSoundWaveData
- isSoundLooped
- isSoundPanningEnabled
- isSoundPaused
- playSFX
- playSFX3D
- playSound
- playSound3D
- setRadioChannel
- setSoundEffectEnabled
- setSoundEffectParameter
- setSoundMaxDistance
- setSoundLooped
- setSoundMinDistance
- setSoundPan
- setSoundPanningEnabled
- setSoundPaused
- setSoundPosition
- setSoundProperties
- setSoundSpeed
- setSoundVolume
- stopSound