FindSound

From Liberty Unleashed Wiki
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function finds a Sound from an ID/name and returns the pointer. If no sound is found, null will be returned.

Syntax

  1. sound FindSound( string name )
  1. 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'.

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "findsound" )
  5. {
  6. local pSound = FindSound( "moo.mp3" );
  7. if ( pSound ) MessagePlayer( "moo.mp3 was found!", pPlayer );
  8. }
  9. return 1;
  10. }
  11.  
  12.  

Notes

The function MessagePlayer and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox