View Single Post
10-30-17, 10:14 PM   #12
ballistics1142
A Deviate Faerie Dragon
Join Date: Apr 2017
Posts: 14
Originally Posted by Kanegasi View Post
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:
  1. local blockedsounds={
  2.     igCharacterInfoClose=840,
  3.     igCharacterInfoOpen=839,
  4.     igMainMenuClose=851,
  5.     igMainMenuOpen=850,
  6.     igPlayerInvite=880,
  7.     igQuestListClose=876,
  8.     igQuestListOpen=875,
  9.     [839]=839,
  10.     [840]=840,
  11.     [850]=850,
  12.     [851]=851,
  13.     [875]=875,
  14.     [876]=876,
  15.     [880]=880,
  16. }
  17.  
  18. local function silence(name,handle,_,_,own)
  19.     if blockedsounds[name] and not own then
  20.         _,handle=PlaySound(64,'Master',false,nil,true)
  21.         if handle then
  22.             StopSound(handle) StopSound(handle-1)
  23.         end
  24.     end
  25. end
  26.  
  27. 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.

So before I go an further, is that example above a working revision?
  Reply With Quote