AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to block a sound (https://forums.alliedmods.net/showthread.php?t=101699)

Alucard^ 08-26-2009 08:34

How to block a sound
 
Simple question... how can i block a sound that is in the "sound" folder? In "cstrike", not "valve".

Thx to much.

xPaw 08-26-2009 08:38

Re: How to block a sound
 
FM_EmitSound ?

Alucard^ 08-27-2009 01:28

Re: How to block a sound
 
Sry, i forget about that... now i tried this but doesn't work:

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN    "Warped block sound"
#define AUTHOR    "Alucard"
#define VERSION    "1.0"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    new 
mapname[32]
    
get_mapname(mapnamecharsmax(mapname) )
    
    if(
equali(mapname"surf_warped") )
        
register_forward(FM_EmitSound,"MapSound")
}

public 
MapSound(idchannel, const sound[])
{
    if(
equal(sound"ravesound.wav") )
        return 
FMRES_SUPERCEDE
    
    
return FMRES_IGNORED


Is wrong?

Thx.

Exolent[jNr] 08-27-2009 01:38

Re: How to block a sound
 
That would be right if the sound is at:
cstrike/sound/ravesound.wav

Alucard^ 08-27-2009 01:48

Re: How to block a sound
 
Hmm and... what is wrong?

The specific destination of file? ("ravesound.wav")

Or the FM_EmitSound to detect a sound that is in "cstrike/sound"?

Or something new that i have to do into the FM_EmitSound?

Thx.

EDIT: Also, changed equali to equal cuz is useless to use that here ><

Exolent[jNr] 08-27-2009 01:53

Re: How to block a sound
 
I said that if the sound file for that map is located at: cstrike/sound/ravesound.wav then your plugin should work fine.
EmitSound hooks sound files from the cstrike/sound directory.

Example, if you are hooking the cstrike/sound/weapons/knife_deploy1.wav , then you would use "weapons/knife_deploy1.wav" in the plugin.

Alucard^ 08-27-2009 02:04

Re: How to block a sound
 
Oh, i misunderstand what you said...

So, my plugin should work fine, the problem is that don't work o.o

P.S: Is a sound of the map (surf_warped) maybe this is the problem? =/

hlstriker 08-27-2009 17:06

Re: How to block a sound
 
This should work. Didn't test it though...

PHP Code:

public plugin_precache()
    
register_forward(FM_KeyValue"fwd_KeyValue");

public 
fwd_KeyValue(const iEnt, const hKvd)
{
    if(
pev_valid(iEnt))
    {
        new 
szValue[48];
        
get_kvd(hKvdKV_ValueszValuesizeof(szValue)-1);
        if(
equal(szValue"ravesound.wav"))
            return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;



Alucard^ 09-02-2009 06:32

Re: How to block a sound
 
Hi... i post to say: "Thx hlstriker"...

The code work perfect...

Thx to much.

EDIT: Oh and, i have another question... how to block the sound for only certains players...? I dont want the complete code, i want the method.

Exolent[jNr] 09-02-2009 08:40

Re: How to block a sound
 
Well, his code stops the entity from being able to play the sound by removing the sound from its data.


All times are GMT -4. The time now is 15:08.

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