Sound manager (or something like that)

Hello guys. I know GMOD has surface.playsound and other sound functions. I was on the GMOD wiki and I saw the sound library. I want to know How can I do some sounds to play for x seconds. And then repeat when It’s over.

There are numerous ways, but you will have to use timers.

Either use timer.Create or do a old school timer with CurTime and some variables.

Which is better depends on how you play your sounds.

Searching on gmod Wiki I saw sound.add. I also know surface.playsound and entity:playsound(). There’s any simple sound remover? Cause I found this Class:



local mysound = CreateSound( "test.wav" )
mysound:Play()
timer.Add("Sound remover", 10, 1, function() mysound:Stop() end)