PreloadMissionAudio
Jump to navigation
Jump to search
This function preloads a game sound into a specific sound slot. The sound can then be played with PlayMissionAudio.
Syntax
Click to collapse [-]
Serverbool preloadMissionAudio ( player thePlayer, int sound, int slot )
Required Arguments
Click to collapse [-]
Clientbool preloadMissionAudio ( int sound, int slot )
Required Arguments
Returns
Returns true if the sound was successfully preloaded, false otherwise.
Example
Click to collapse [-]
serverThis example plays a sound when a player spawns
function onPlayerSpawn ( theSpawnpoint, theTeam ) preloadMissionAudio ( source, 5000, 1 ) local x, y, z = getElementPosition ( source ) playMissionAudio ( source, 1, x, y, z ) end addEventHandler ( "onPlayerSpawn", getElementRoot(), onPlayerSpawn )
Click to collapse [-]
clientThis example plays a sound when the server triggers the onSoundEvent client event.
function onSoundEvent ( ) preloadMissionAudio ( source, 5000, 1 ) local x, y, z = getElementPosition ( source ) playMissionAudio ( 1, x, y, z ) end addEvent ( "onSoundEvent" ) addEventHandler ( "onSoundEvent", getElementRoot(), onSoundEvent )
See Also