Squirrel/Server/Functions/Sounds/Play
From Liberty Unleashed Wiki
(Difference between revisions)
m |
m |
||
Line 23: | Line 23: | ||
{ | { | ||
sound.Open(); | sound.Open(); | ||
− | sound.Play( pPlayer); | + | sound.Play( pPlayer ); |
} | } | ||
} | } |
Revision as of 01:23, 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( pPlayer ); } } return 1; }
Notes
The event onPlayerCommand was used in this example. More info about this in the corresponding page.