Squirrel/Server/Functions/Sounds/Open

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|Sound.Open}} This function opens a local sound stored in the server files, making the soundfile is ready to be played. == Syntax == <code>bool Sound.Open( play…')
 
m
Line 1: Line 1:
 
{{Squirrel/Title|Sound.Open}}
 
{{Squirrel/Title|Sound.Open}}
This function opens a local sound stored in the server files, making the soundfile is ready to be played.
+
This function opens a sound, making the sound is ready to be played.
  
 
== Syntax ==
 
== Syntax ==
Line 8: Line 8:
 
== Arguments ==
 
== Arguments ==
  
* '''plr''' - The player to open the file for
+
* '''plr''' - The player to open the sound for
  
 
== Example ==
 
== Example ==

Revision as of 14:33, 17 August 2011

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function opens a sound, making the sound is ready to be played.

Syntax

  1. bool Sound.Open( player plr )

Arguments

  • plr - The player to open the sound for

Example

This code will play the sound 'moo.mp3' for a player when they type '/moo'.

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "moo" )
  5. {
  6. local sound = FindSound( "moo.mp3" );
  7. if ( sound )
  8. {
  9. sound.Open( pPlayer );
  10. sound.Play( pPlayer );
  11. sound.Close( pPlayer );
  12. }
  13. }
  14. return 1;
  15. }
  16.  

Notes

The event onPlayerCommand was used in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox