If you want to mute
all sounds, use this:
Lua Code:
local dummy = false
hooksecurefunc('PlaySound', function(id)
if dummy then return end
dummy = true
local played, handle = PlaySound(id+1)
if played then
StopSound(handle-1)
StopSound(handle)
end
dummy = false
end)
If you want to allow unique sounds, like the talking head monologues or any other uncommon sound, but
not UI sounds, use this:
Lua Code:
local dummy, kit = false, {}
for _, v in pairs(SOUNDKIT) do kit[v] = true end
hooksecurefunc('PlaySound', function(id)
if dummy or (not kit[id]) then return end
dummy = true
local played, handle = PlaySound(id+1)
if played then
StopSound(handle-1)
StopSound(handle)
end
dummy = false
end)
If you want to mute
specific sounds use Kanegasi's solution. They all work the same way.