Raised This Month: $ Target: $400
 0% 

STOP EmitSoundToAll


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zeroibis
Veteran Member
Join Date: Jun 2007
Old 04-05-2013 , 18:54   STOP EmitSoundToAll
Reply With Quote #1

How would one go about stopping something that is already playing from EmitSoundToAll()
__________________
zeroibis is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 04-05-2013 , 20:26   Re: STOP EmitSoundToAll
Reply With Quote #2

Hook sounds with AddNormalSoundHook then detect the sound in the callback returning Plugin_Stop on all sounds you want to block.
__________________
11530 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-05-2013 , 21:17   Re: STOP EmitSoundToAll
Reply With Quote #3

Specify a channel when you do EmitSoundToAll, then loop through all clients calling StopSound on that sample and channel.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 04-05-2013 at 21:28.
Powerlord is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 04-05-2013 , 21:34   Re: STOP EmitSoundToAll
Reply With Quote #4

My bad, read that as blocking and not stopping.
__________________
11530 is offline
zeroibis
Veteran Member
Join Date: Jun 2007
Old 04-06-2013 , 00:10   Re: STOP EmitSoundToAll
Reply With Quote #5

So it would be something like:

Code:
EmitSoundToAll(SOUND,client,SNDCHAN_VOICE);
Code:
for(new i=1;i<=MaxClients;i++)
    {
        StopSound(i, SNDCHAN_VOICE, SOUND);
    }
This would play SOUND and stop SOUND, correct?
__________________
zeroibis is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-06-2013 , 01:01   Re: STOP EmitSoundToAll
Reply With Quote #6

Quote:
Originally Posted by zeroibis View Post
So it would be something like:

Code:
EmitSoundToAll(SOUND,client,SNDCHAN_VOICE);
This would play SOUND and stop SOUND, correct?
Not quite, when calling StopSound, you need to check if the client is in game before stopping it.

PHP Code:
for(new i=1;i<=MaxClients;i++)
    {
        if (
IsClientInGame(i))
            {
                
StopSound(iSNDCHAN_VOICESOUND);
            }
    } 
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
zeroibis
Veteran Member
Join Date: Jun 2007
Old 04-06-2013 , 01:42   Re: STOP EmitSoundToAll
Reply With Quote #7

Also so far the sound only plays with SNDCHAN_AUTO I am trying the rest 1 by 1 but no success so far.

SNDCHAN_STREAM works
__________________

Last edited by zeroibis; 04-06-2013 at 01:47.
zeroibis is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 04-06-2013 , 04:00   Re: STOP EmitSoundToAll
Reply With Quote #8

I have this problem with entities created that emit sound from gibs fired by envshooters, they never stop their burning sounds sometimes, even when you destroy them =/
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
zeroibis
Veteran Member
Join Date: Jun 2007
Old 04-06-2013 , 05:07   Re: STOP EmitSoundToAll
Reply With Quote #9

you mean burning sound from an ignightentity command? You need to extinguish the ent before destroying it or the sound can get stuck.
__________________
zeroibis is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 04-06-2013 , 06:39   Re: STOP EmitSoundToAll
Reply With Quote #10

Quote:
Originally Posted by zeroibis View Post
you mean burning sound from an ignightentity command? You need to extinguish the ent before destroying it or the sound can get stuck.
I think that's it, but it might be a problem with this specific ent. I forget

env_shooter with spawnflags 6, I think it fires burning gibs,

Flags

2 : On fire <<<<
4 : strict remove after lifetime
GibshooterBase:
1 : Repeatable

Mabye it's this problem. I think the gib shooter creates gibs, so i'd need to extinguish those before they get deleted. I think they delete on their own as is when these spawnflags are set, but the engine doesn't handle it properly. I was never able to find a way to remove them reliably or stop the sound from spawning. Could probably do it with a sound hook though.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:35.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode