Garry's Mod Wiki

Revision Difference

surface.PlaySound#547778

<function name="PlaySound" parent="surface" type="libraryfunc"> <description>Play a sound file directly on the client (such as UI sounds, etc).</description> <realm>Client and Menu</realm> <args> <arg name="soundfile" type="string">The path to the sound file. <bug issue="5341"> Currently does not work with sound scripts (<page>sound.Add</page>)</bug> <bug issue="4504"> Currently does not work with sound scripts (<page>sound.Add</page>)</bug> This should either be a sound script name (<page>sound.Add</page>) or a file path relative to the `sound/` folder. (Make note that it's not sound**s**) </arg> </args> </function> <example> <description> Plays a sound with a given name. The game will look for the file in following places in that order: * garrysmod/addons/myaddon/sound/`mysound.wav` * garrysmod/gamemodes/mygamemode/content/sound/`mysound.wav` * garrysmod/sound/`mysound.wav` </description> <code>surface.PlaySound( "mysound.wav" )</code> </example>