StartSound (script event)

Game class

This event operates on an instance of the game class type {{{gameclass}}}

Description

Plays the sound specified by the snd_* key/value pair on the channel and returns the length of the sound.

Usage

float startSound( string sound , float channel , float netSync )

Parameters

  • [sound] - The sound to play from this entity.
  • [channel] - The channel to play this sound on.
  • [netSync] - Whether to play this sound across the network or not.

Examples

 
$my_entity.startSound("snd_target_lost", 1, 1);

Notes

This script event does not return any values.

This is the preferred method for playing sounds on an entity since it ensures that the sound is precached.