FindSound
From Liberty Unleashed Wiki
This function finds a Sound from an ID/name and returns the pointer. If no sound is found, null will be returned.
Syntax
sound FindSound( string name )
sound FindSound( int id )
Arguments
- name - The name of the sound (including extension) e.g. boo.mp3
- id - The ID of the sound to be found
Example
This will try and find 'moo.mp3' when the player types '/findsound'.
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "findsound" ) { local pSound = FindSound( "moo.mp3" ); if ( pSound ) MessagePlayer( "moo.mp3 was found!", pPlayer ); } return 1; }
Notes
The function MessagePlayer and event onPlayerCommand were used in this example. More info about them in the corresponding pages.