Plays a file from GMod directory. You can find a list of all error codes here
This fails for looping .wav files in 3D mode.
Issue Tracker: #1752
This fails with unicode file names.
Issue Tracker: #2304
The path to the file to play.Unlike other sound functions and structures, the path is relative to garrysmod/ instead of garrysmod/sound/
Flags for the sound. Can be one or more of following, separated by a space (" "):
Callback function that is called as soon as the the stream is loaded. It has next arguments:
IGModAudioChannel soundchannel - The sound channel. Will be nil if an error occured.
number errorID - ID of an error if an error has occured. Will be nil, otherwise.
string errorName - Name of an error if an error has occured. Will be nil, otherwise.
Plays a piece of music from Half-Life 2.
sound.PlayFile( "sound/music/hl2_song12_long.mp3", "noplay", function( station, errCode, errStr ) if ( IsValid( station ) ) then station:Play() else print( "Error playing sound!", errCode, errStr ) end end )