Squirrel/Server/Functions/Sounds/Open
From Liberty Unleashed Wiki
(Difference between revisions)
m |
m |
||
Line 1: | Line 1: | ||
{{Squirrel/Title|Sound.Open}} | {{Squirrel/Title|Sound.Open}} | ||
− | This function opens a sound, | + | This function opens a sound, allowing the sound to be played. |
== Syntax == | == Syntax == |
Latest revision as of 14:33, 17 August 2011
This function opens a sound, allowing the sound to be played.
[edit] Syntax
bool Sound.Open( player plr )
[edit] Arguments
- plr - The player to open the sound for
[edit] Example
This code will play the sound 'moo.mp3' for a player when they type '/moo'.
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "moo" ) { local sound = FindSound( "moo.mp3" ); if ( sound ) { sound.Open( pPlayer ); sound.Play( pPlayer ); sound.Close( pPlayer ); } } return 1; }
[edit] Notes
The event onPlayerCommand was used in this example. More info about this in the corresponding page.