My head starts explode, so I ask for help.
From the title it is clear what I need. So, for example, I have a function which play sound, but if call function again (before the sound ends), I want next sound to play after the previous sound ends.
Delays and Cooldowns
local cooldown = CurTime()
function GM:PlayerPostThink(ply)
if cooldown + SoundDuration("yoursound.wav") < CurTime() then
ply:EmitSound("yoursound.wav", 75, 100, 1, CHAN_AUTO )
cooldown = CurTime()
end
end
Seems to be working for me. Note: this is made for the client. Another note: From Gmod wiki about SoundDuration:
This function does not work properly in most cases! Some say it only works properly with .wav files.
An old bodge
https://gist.github.com/JohnsonMcBig/d4393e6265e7645c91bd1e6dd9883981
use the QueueSound function to do what you need, it tries to find the duration by itself, but if you encounter inconsistency then input it yourself.
Thank you so much man.
Sorry, you need to Log In to post a reply to this thread.