Raised This Month: $51 Target: $400
 12% 

Need some help block sound being played


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 08-30-2017 , 18:54   Need some help block sound being played
Reply With Quote #1

Hello!
Is there a way i can block a sound played and precached by a specific module?

For example the sound precached and played is bomb_explode.wav

How can i block/prevent playing when it happens by a plugin ? Thank you
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-30-2017 , 21:41   Re: Need some help block sound being played
Reply With Quote #2

You can register FM_PrecacheSound/FM_EmitSound, check if the sound is equal "bomb_explode.wav" and then return FMRES_SUPERCEDE.
__________________








CrazY. is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 08-30-2017 , 21:44   Re: Need some help block sound being played
Reply With Quote #3

Thank you! Ill try it out
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-18-2017 , 13:58   Re: Need some help block sound being played
Reply With Quote #4

I tried that out, (by the way the sound comes from /valve/sound/weapons/rocketfire1.wav) but i precached the sound , and checked in

FM_EmitSound sound if equals "weapons/rocketfire1.wav" or /sound/weapons/rocketfire1.wav" etc... and return FMRES_SUPERCEDE;

but the sound is still playing when i shot with a Specific Weapon created, by a module.

Any way to BLOCK it playing ?
__________________

Last edited by ghost95v; 09-18-2017 at 14:03.
ghost95v is offline
Send a message via Skype™ to ghost95v
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 09-18-2017 , 15:25   Re: Need some help block sound being played
Reply With Quote #5

If you are referring to the sound of gun shot, then you need to block the standard weapon events, otherwise something is wrong in the function you created. Show me your code.
__________________








CrazY. is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-18-2017 , 17:32   Re: Need some help block sound being played
Reply With Quote #6

Yes , but it's not one of weapon enitites of Cs, is just a bazooka that replaces the knife weapon

the entity of this weapon classname created is "bazooka"

it is coded in a amxx module .so


Idk.. i did this, but it wont stop the sound...



PHP Code:
#include <amxmodx>
#include <fakemeta>

new const Sound[] = { "weapons/rocketfire1.wav" }

public 
plugin_init()
{
    
register_forward(FM_EmitSound"fw_EmitSound")
}

public 
plugin_precache()
{
    
precache_sound(Sound)
}

public 
fw_EmitSound(idchannel, const sample[], Float:volumeFloat:attnflagspitch)
{

    if( 
equal(sampleSound))
    {
        return 
FMRES_SUPERCEDE;
    }
    return 
FMRES_IGNORED;

__________________

Last edited by ghost95v; 09-18-2017 at 17:53.
ghost95v is offline
Send a message via Skype™ to ghost95v
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-18-2017 , 20:06   Re: Need some help block sound being played
Reply With Quote #7

Code looks good and I tested it myself on c4 beeps. Try making sure you are blocking the correct sound. Put this above the if ( equal() line.

PHP Code:
client_printprint_chat "Sounds=[%s]" sample 
__________________
Bugsy is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-18-2017 , 20:23   Re: Need some help block sound being played
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
Code looks good and I tested it myself on c4 beeps. Try making sure you are blocking the correct sound. Put this above the if ( equal() line.

PHP Code:
client_printprint_chat "Sounds=[%s]" sample 

I did that. Doesn't appear nothing...

PHP Code:
public fw_EmitSound(idchannel, const sample[])
{
    if(
equal(sample"weapons/rocketfire1.wav") || equal(sample"rocketfire1.wav"))
    {
        
client_printprint_chat "Sounds=[%s]" sample )
        return 
FMRES_SUPERCEDE;
    }
    
    
    return 
FMRES_IGNORED

__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 09-18-2017 , 20:25   Re: Need some help block sound being played
Reply With Quote #9

Try with case insensitive also (equali). You're playing the sound with client_cmd or emit_sound?

Sounds emited in guns events (primary/secondary attack, reload, deploy...) don't is detected by FM_EmitSound.

P.S: before of compare sounds, don't while the condition is checked.

Code:
public fw_EmitSound(id, channel, const sample[]) { client_print( 0 , print_chat , "Sounds=[%s]" , sample )     if(equal(sample, "weapons/rocketfire1.wav") || equal(sample, "rocketfire1.wav"))     {         return FMRES_SUPERCEDE;     }                 return FMRES_IGNORED }
__________________









Last edited by CrazY.; 09-18-2017 at 20:35.
CrazY. is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-18-2017 , 21:03   Re: Need some help block sound being played
Reply With Quote #10

Quote:
Originally Posted by CrazY. View Post
Try with case insensitive also (equali). You're playing the sound with client_cmd or emit_sound?

Sounds emited in guns events (primary/secondary attack, reload, deploy...) don't is detected by FM_EmitSound.

P.S: before of compare sounds, don't while the condition is checked.

Code:
public fw_EmitSound(id, channel, const sample[]) { client_print( 0 , print_chat , "Sounds=[%s]" , sample )     if(equal(sample, "weapons/rocketfire1.wav") || equal(sample, "rocketfire1.wav"))     {         return FMRES_SUPERCEDE;     }                 return FMRES_IGNORED }

Still doesn't print the "weapons/rocketfire1.wav" or rocketfire1.wav when i shot, the others are being printed...

the sound is playing with EmitSound in amxx module

in this part

PHP Code:
void PlayerPreThinkedict_t pPlayer ) { 
and if Button ATTACK2

PHP Code:
if( Button IN_ATTACK2)
g_engfuncs.pfnEmitSoundedict_playerCHAN_VOICE"weapons/rocketfire1.wav"1.0ATTN_NORM0PITCH_NORM ); 
__________________

Last edited by ghost95v; 09-18-2017 at 21:07.
ghost95v is offline
Send a message via Skype™ to ghost95v
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 11:38.


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