Squirrel/Server/Functions/Sounds/Play

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|Sound.Play}} This function plays a local sound stored in the server files. == Syntax == <code>bool Sound.Play( player plr )</code> == Arguments == * '''plr''…')
 
Line 34: Line 34:
  
 
The event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in this example. More info about this in the corresponding page.
 
The event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in this example. More info about this in the corresponding page.
 +
 +
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Sounds}}
 
{{Squirrel/Server/Functions/Sounds}}

Revision as of 01:22, 17 August 2011

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

This function plays a local sound stored in the server files.

Syntax

  1. bool Sound.Play( player plr )

Arguments

  • plr - The player to play 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();
  10. sound.Play();
  11. }
  12. }
  13. return 1;
  14. }
  15.  

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