IsSoundPaused: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Added Example)
No edit summary
Line 20: Line 20:
     local pause = isSoundPaused(theSound)
     local pause = isSoundPaused(theSound)
     if(pause == true) then
     if(pause == true) then
         outputChatBox("The sound is paused!", getLocalPlayer())
         outputChatBox("The sound is paused!")
     else
     else
         outputChatBox("The sound is not paused!", getLocalPlayer())
         outputChatBox("The sound is not paused!")
     end
     end
end
end

Revision as of 19:28, 28 November 2009

This function is used to return the current pause state of the specified sound element.

Syntax

bool isSoundPaused ( element theSound )

Required Arguments

  • theSound: The sound element which pause state you want to return.

Returns

Returns true if the sound element is paused, false if unpaused or invalid arguments were passed.

Example

This example will check and see if the sound is paused or not, and tell the player.

Click to collapse [-]
Client
theSound = playSound("music/song.mp3")
function checkSongPause()
    local pause = isSoundPaused(theSound)
    if(pause == true) then
        outputChatBox("The sound is paused!")
    else
        outputChatBox("The sound is not paused!")
    end
end
addCommandHandler("checkpause", checkSongPause)

See Also