PlayMissionAudio
From Multi Theft Auto: Wiki
Function has been disabled. | |
Reason/Note: Its functionality left for a post-r1 release - Bugtracker Issue: #1838 |
This function plays a game sound in a specific slot. Be sure to preload your sound with PreloadMissionAudio into the slot beforehand. An optional position element can be specified.
Usage
Both server side and client side. "thePlayer" argument isn't used in the client side version of this function.
Syntax
Click to collapse [-]
Serverbool playMissionAudio ( player thePlayer, int slot, float x, float y, float z )
Required Arguments
Click to expand [+]
ClientReturns
Returns true if the sound was successfully played, 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