HU/PlaySFX: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
No edit summary  | 
				No edit summary  | 
				||
| Line 3: | Line 3: | ||
{{New feature/item|3.0134|1.3.4|5731|  | {{New feature/item|3.0134|1.3.4|5731|  | ||
This function plays a sound from GTA's big sound containers.  | This function plays a sound from GTA's big sound containers.  | ||
}}  | |HU}}  | ||
{{Note|There is a tool available which allows you to find bank and sound IDs easily: [[https://community.mtasa.com/index.php?p=resources&s=details&id=7549 sfxBrowser:Download]].}}  | {{Note|There is a tool available which allows you to find bank and sound IDs easily: [[https://community.mtasa.com/index.php?p=resources&s=details&id=7549 sfxBrowser:Download]].}}  | ||
| Line 41: | Line 41: | ||
==Returns==  | ==Returns==  | ||
Returns a [[sound]] element if the sound was successfully created, ''false'' otherwise.  | Returns a [[sound]] element if the sound was successfully created, ''false'' otherwise.  | ||
}}  | |HU}}  | ||
==Example==  | ==Example==  | ||
Latest revision as of 21:12, 17 June 2021
This function plays a sound from GTA's big sound containers.
Syntax
element playSFX ( string containerName, int bankId, int soundId [, bool looped = false ] )
Required Arguments
- containerName: The name of the audio container. Possible values are: "feet", "genrl", "pain_a", "script", "spc_ea", "spc_fa", "spc_ga", spc_na", "spc_pa"
 - bankId: The audio bank id
 - soundId: The sound id within the audio bank
 
Optional Arguments
- looped: A boolean representing whether the sound will be looped
 
Returns
Returns a sound element if the sound was successfully created, false otherwise.
Syntax 2
element playSFX ( string "radio", string radioStation, int trackId [, bool looped = false ] )
Required Arguments
- radio: The string "radio" (used to differentiate to the first syntax)
 - radioStation: The radio station. Possible values are "Adverts", "Ambience", "Police", "Playback FM", "K-Rose", "K-DST", "Cutscene", "Beats", "Bounce FM", "SF-UR", "Radio Los Santos", "Radio X", "CSR 103.9", "K-Jah West", "Master Sounds 98.3", "WCTR".
 - trackId : The radio track id within the radio station audio file
 
Optional Arguments
- looped: A boolean representing whether the sound will be looped
 
Returns
Returns a sound element if the sound was successfully created, false otherwise.
Example
The following example plays a firealarm sound (looped).
if not playSFX("script", 7, 1, true) then
    outputChatBox("You have to install some missing audio files to hear the sound")
end
See Also
- HU/getRadioChannel
 - HU/getRadioChannelName
 - HU/getSFXStatus
 - HU/getSoundBPM
 - HU/getSoundEffects
 - HU/getSoundFFTData
 - HU/getSoundLength
 - HU/getSoundLevelData
 - HU/getSoundMaxDistance
 - HU/getSoundMetaTags
 - HU/getSoundMinDistance
 - HU/getSoundPan
 - HU/getSoundPosition
 - HU/getSoundProperties
 - HU/getSoundSpeed
 - HU/getSoundVolume
 - HU/getSoundWaveData
 - HU/isSoundPanningEnabled
 - HU/isSoundPaused
 - HU/playSFX
 - HU/playSFX3D
 - HU/playSound
 - HU/playSound3D
 - HU/playSoundFrontEnd
 - HU/setRadioChannel
 - HU/setSoundEffectEnabled
 - HU/setSoundMaxDistance
 - HU/setSoundMinDistance
 - HU/setSoundPan
 - HU/setSoundPanningEnabled
 - HU/setSoundPaused
 - HU/setSoundPosition
 - HU/setSoundProperties
 - HU/setSoundSpeed
 - HU/setSoundVolume
 - HU/stopSound