Function
playSFX
Plays a sound from San Andreas' own sound banks (footsteps, weapons, collisions, vehicles, mission sounds) with no position in the world. The game's sound engine plays it, so it follows the game's effects volume.
Syntax
sound playSFX(string audioContainer, int bankIndex, int soundIndex [, bool looped = false])Arguments
audioContainerstring- The container:
"feet","genrl","pain_a","script","spc_ea","spc_fa","spc_ga","spc_na","spc_pa". bankIndexint- The bank number in the container (from 0).
soundIndexint- The sound number in the bank (from 0).
loopedbool, optional = false- Whether to loop.
Returns
A sound element or false (the reason is written to the debug log).
Example
-- strzal z M4 (bank 136 pojemnika genrl to bron)
if isSFXBankLoaded("genrl", 136) then
playSFX("genrl", 136, 33)
end
Notes
Only a bank the game has loaded right now will play. The game keeps a few dozen banks in memory at once. The genrl banks with weapons, collisions and footsteps are usually loaded, while script and spc_* banks are loaded only during missions. Check with isSFXBankLoaded. The "radio" container is not supported.
It works only for this player and does not go to other players. Compatible with MTA, but bank numbers are from the Definitive Edition.
See also
playSFX3DPlays a sound from the game's banks at a point in the world. The game's sound engine handles fading with distance and panning.isSFXBankLoadedChecks whether the game has a sound bank loaded right now. Only such a bank plays throughplaySFXandplaySFX3D.getSFXBankSoundCountWithout a bank number it returns the number of banks in the container. With a bank number it returns the number of sounds in that bank.stopSoundStops a sound and removes it. FiresonClientSoundStoppedwith the reason"destroyed".