PlaySound(string)

Plays a sound on the client machine.

void PlaySound(
    string sSoundName
);

Parameters

sSoundName

The name of the sound to play.


Description

Play the wave resource named sSoundName.



Remarks

PlaySound returns immediately, it does not wait for the sound to finish playing. If you want to play a sound using a trigger, then look at the SoundObjectPlay function, as PlaySound requires an object to work.


Known Bugs

This might not be an actual bug, but though PlaySound isn't an action (you don't get the little yellow square on the screen), if you assign a PlaySound to someone, it will wait for their current action queue to finish before playing.


Version

1.61

Example

// Placed in the OnUsed event of the an object, for example a gong. The following script will cause a gong ring to sound.

main()
{
    PlaySound("as_cv_gongring2");
}

See Also

functions: SoundObjectPlay
categories: Sound Effects Functions


 author: Tom Cassiotis, editor: Lilac Soul, additional contributor(s): Lilac Soul