stopSound | Multi Theft Auto: Wiki Skip to content

stopSound

Client-side
Server-side
Shared

Stops the sound playback for specified sound element. The sound element is also destroyed.

OOP Syntax Help! I don't understand this!

Syntax

bool stopSound ( sound theSound )
Required Arguments
  • theSound: The sound element you want to stop playing.

Returns

  • bool: result

Returns true if the sound was successfully stopped, false otherwise.

Code Examples

client
local sound
function startMySound()
sound = playSound("sound.mp3", true)
end
addEventHandler("onClientResourceStart", resourceRoot, startMySound)
function stopMySound()
stopSound(sound)
end
addCommandHandler("stopsound", stopMySound) -- using the command 'stopsound' will stop the sound