Revision Difference
Global.EmitSound#514799
<function name="EmitSound" parent="Global" type="libraryfunc">⤶
<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>⤶
<bug>This does not work with soundscripts. TODO: Is this a bug or intended?</bug>⤶
</description>⤶
<realm>Shared</realm>⤶
<args>⤶
<arg name="soundName" type="string">The sound to play</arg>⤶
<arg name="position" type="Vector">The position to play at</arg>⤶
<arg name="entity" type="number">The entity to emit the sound from. Can be an <page>Entity:EntIndex</page> 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)</arg>⤶
<arg name="channel" type="number" default="CHAN_AUTO">The sound channel, see <page>CHAN</page>.</arg>⤶
<arg name="volume" type="number" default="1">The volume of the sound, from 0 to 1</arg>⤶
<arg name="soundLevel" type="number" default="75">The sound level of the sound, see <page>SNDLVL</page></arg>⤶
<arg name="soundFlags" type="number" default="0">The flags of the sound, see <page>SND</page></arg>⤶
<arg name="pitch" type="number" default="100">The pitch of the sound, 0-255</arg>⤶
</args>⤶
</function>⤶
⤶
<example>⤶
<description>Plays magical sound on first player.</description>⤶
<code>EmitSound( Sound("garrysmod/save_load1.wav"), Entity(1):GetPos(), 1, CHAN_AUTO, 1, 75, 0, 100 )</code>⤶
⤶
</example>