Squirrel/Server/Functions/Sounds/Play
From Liberty Unleashed Wiki
(Difference between revisions)
(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''…') |
Revision as of 01:21, 17 August 2011
This function plays a local sound stored in the server files.
Syntax
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'.
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "moo" ) { local sound = FindSound( "moo.mp3" ); if ( sound ) { sound.Open(); sound.Play(); } } return 1; }
Notes
The event onPlayerCommand was used in this example. More info about this in the corresponding page.