Garry's Mod Wiki

EmitSound

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

Description

Emits the specified sound at the specified position.

Sounds must be precached serverside manually before they can be played. util.PrecacheSound does not work for this purpose, Entity:EmitSound does the trick

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. Can be an Entity:EntIndex or one of the following:

  • 0 - Plays sound on the world (position set to 0,0,0)
  • -1 - Plays sound on the local player (on server acts as 0)
  • -2 - Plays UI sound (position set to 0,0,0, no spatial sound, on server acts as 0)
4 number channel = CHAN_AUTO
The sound channel, see Enums/CHAN.
5 number volume = 1
The volume of the sound, from 0 to 1
6 number soundLevel = 75
The sound level of the sound, see Enums/SNDLVL
7 number soundFlags = 0
The flags of the sound, see Enums/SND
8 number pitch = 100
The pitch of the sound, 0-255
9 number dsp = 0
The DSP preset for this sound. List of DSP presets

Example

Plays magical sound on first player.

EmitSound( Sound( "garrysmod/save_load1.wav" ), Entity(1):GetPos(), 1, CHAN_AUTO, 1, 75, 0, 100 )

Page Links


Special Pages


Wikis

?

Render Time: 63ms

DB GetPage 3
Generate Html 26
SaveChanges (1) 10
Render Body 0
Render Sidebar 18