Garry's Mod Wiki

Revision Difference

surface.PlaySound#547073

<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, which must be relative to the sound/ folder.</arg>⤶ <arg name="soundfile" type="string">The path to the sound file.⤶ <validate>Does this function support sound scripts?</validate>⤶ 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⤶ * 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>