Advertisement
Guest User

Universal Sound Replacement

a guest
Feb 27th, 2024
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. version "4.11"
  2.  
  3. class TestHandler : EventHandler
  4. {
  5. override void WorldTick()
  6. {
  7. foreach (p : players)
  8. {
  9. if (!p.mo)
  10. {
  11. continue;
  12. }
  13.  
  14. int num = p.mo.PlayerNumber();
  15.  
  16. // [Ace] Need to make sure it's playing a sound on the channel but it's not YOUR sound. Only replace once until either the sound changes or stops.
  17. if (p.mo.Player.ReadyWeapon is 'Pistol' && p.mo.IsActorPlayingSound(CHAN_WEAPON) && !p.mo.IsActorPlayingSound(CHAN_WEAPON, "TestSoundLmao") && !ReplacedSound[num] && Level.MapName ~== "MAP15")
  18. {
  19. p.mo.A_StopSound(CHAN_WEAPON);
  20. p.mo.A_StartSound("TestSoundLmao", CHAN_WEAPON);
  21. ReplacedSound[num] = true;
  22. }
  23. else
  24. {
  25. ReplacedSound[num] = false;
  26. }
  27. }
  28. }
  29.  
  30. bool ReplacedSound[MAXPLAYERS];
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement