Garry's Mod Wiki

EmitSentence

  EmitSentence( string soundName, Vector position, number entity, number channel = CHAN_AUTO, number volume = 1, number soundLevel = 75, number soundFlags = 0, number pitch = 100 )

Description

Plays a sentence from scripts/sentences.txt

Arguments

1 string soundName
The sound to play
2 Vector position
The position to play at
3 number entity
The entity to emit the sound from. Must be Entity:EntIndex
4 number channel = CHAN_AUTO
The sound channel, see CHAN enum.
5 number volume = 1
The volume of the sound, from 0 to 1
6 number soundLevel = 75
The sound level of the sound, see SNDLVL enum
7 number soundFlags = 0
The flags of the sound, see SND enum
8 number pitch = 100
The pitch of the sound, 0-255

Example

Plays random combine death sound on first player.

EmitSentence( "COMBINE_DIE" .. math.random( 0, 2 ), Entity( 1 ):GetPos(), 1, CHAN_AUTO, 1, 75, 0, 100 )