It was a shame PlaySoundKitID was removed. I used this hack to silence some UI sounds and the UI never, as far as I knew, didn't even use KitID, so I hooked PlaySound and then used PlaySoundKitID to generate the handle+1. Instead of the variable switch you have, I went with adding an extra argument to PlaySound.
Lua Code:
local blockedsounds={
igCharacterInfoClose=840,
igCharacterInfoOpen=839,
igMainMenuClose=851,
igMainMenuOpen=850,
igPlayerInvite=880,
igQuestListClose=876,
igQuestListOpen=875,
[839]=839,
[840]=840,
[850]=850,
[851]=851,
[875]=875,
[876]=876,
[880]=880,
}
local function silence(name,handle,_,_,own)
if blockedsounds[name] and not own then
_,handle=PlaySound(64,'Master',false,nil,true)
if handle then
StopSound(handle) StopSound(handle-1)
end
end
end
hooksecurefunc('PlaySound',silence)
I also have a framepool I left out that skips a frame then checks for a block variable and plays the sound anyways if the block variable is false. The sound names in the table were left in from when PlaySound used those, I kept them for history's sake.