EmitSound

From Garry's Mod
Jump to: navigation, search
 EmitSound( )

Contents

Description

Emits the specified sound at the specified position.

BUG

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

BUG

This does not work with soundscripts. TODO: Is this a bug or intended?

Arguments

string soundName

The sound to play

Arguments

Vector position

The position to play at

Arguments

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)

Arguments

number channel=CHAN_AUTO

The sound channel, see CHAN_ Enums.

Arguments

number volume=1

The volume of the sound, from 0 to 1

Arguments

number soundLevel=75

The sound level of the sound, see SNDLVL_ Enums

Arguments

number soundFlags=0

The flags of the sound, see SND_ Enums

Arguments

number pitch=100

The pitch of the sound, 0-255

Examples

Example

Plays magical sound on first player.

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


Personal tools
Navigation