DestroySound: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|DestroySound(sound)}} {{FuncParameters}} {{FuncParam|sound|__EDIT_ME__}} {{FuncReturnValue|__EDIT...")
 
No edit summary
 
Line 1: Line 1:
{{Info|Function|Client|1.0}}
{{Info|Function|Client|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Destroy the sound created with [[CreateSound]].}}


{{FuncSyntax|DestroySound(sound)}}
{{FuncSyntax|DestroySound(sound)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|sound|__EDIT_ME__}}
{{FuncParam|sound|The sound identifier.}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|This function returs nothing.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua>
function PlayAudioFile(file)
DestroySound(LastSoundPlayed)
 
LastSoundPlayed = CreateSound("client/files/"..file)
SetSoundVolume(LastSoundPlayed, 1.1)
end
AddRemoteEvent("PlayAudioFile", PlayAudioFile)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{Template:SoundFunctions}}

Latest revision as of 12:54, 20 November 2019

DestroySound

Type: Function
Context: Client
Introduced: v1.0

Description

Destroy the sound created with CreateSound.

Syntax

DestroySound(sound)

Parameters

  • sound
    The sound identifier.

Return Value

  • This function returs nothing.

Example

function PlayAudioFile(file)
	DestroySound(LastSoundPlayed)

	LastSoundPlayed = CreateSound("client/files/"..file)
	SetSoundVolume(LastSoundPlayed, 1.1)
end
AddRemoteEvent("PlayAudioFile", PlayAudioFile)

See also