AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   How to remove 'kill' sound (https://forums.alliedmods.net/showthread.php?t=193170)

tcPane 08-17-2012 07:01

How to remove 'kill' sound
 
Hello,
how can I remove 'kill' sound?

Explain:
When player write kill in the console, he dies and run sound. I want to remove this sound. How?

matsi 08-17-2012 08:02

Re: How to remove 'kill' sound
 
Code:
#include <amxmodx> #include <fakemeta> new g_die_sounds[][] = {     "player/die1.wav",     "player/die2.wav",     "player/die3.wav",     "player/death6.wav" };     public plugin_precache() {     register_plugin( "Block die sound", "1.0", "matsi" );     register_forward( FM_EmitSound, "FwdEmitSound" ); } public FwdEmitSound( const entity, const channel, const sound[], const Float:volume, const Float:attenuation, const flags, const pitch ) {     for( new i; i < sizeof g_die_sounds; i ++ )     {         if( equal( sound, g_die_sounds[ i ] ) )         return FMRES_SUPERCEDE;     }     return FMRES_IGNORED; }

I'm not sure if thats the correct way to do it or if there are all the sounds you wanted to be blocked. :oops:

But try it. :attack:

tcPane 08-18-2012 02:36

Re: How to remove 'kill' sound
 
Thank you, this works, but is there more short way?

YamiKaitou 08-18-2012 07:43

Re: How to remove 'kill' sound
 
Short way? What is wrong with this way?

ConnorMcLeod 08-18-2012 08:01

Re: How to remove 'kill' sound
 
Little optimazation.

PHP Code:

#include <amxmodx>
#include <fakemeta>

new Trie:g_tBlockPlayersSounds

new g_iMaxPlayers
#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )
    
public plugin_precache()
{
    
register_plugin"Block die sound""1.1""matsi" );
    
    
register_forwardFM_EmitSound"FwdEmitSound" );

    new 
die_sounds[][] =
    {
        
"player/die1.wav",
        
"player/die2.wav",
        
"player/die3.wav",
        
"player/death6.wav"
    
};
    
g_tBlockPlayersSounds TrieCreate();
    for(new 
ii<sizeof(die_sounds); i++)
    {
        
TrieSetCell(g_tBlockPlayersSoundsdie_sounds[i], 1);
    }

    
g_iMaxPlayers get_maxplayers();
}

public 
FwdEmitSound( const entity, const channel, const sound[] /* , const Float:volume, const Float:attenuation, const flags, const pitch */ )
{
    if( 
IsPlayer(entity) && TrieKeyExists(g_tBlockPlayersSoundssound) )
    {
        return 
FMRES_SUPERCEDE;
    }
    return 
FMRES_IGNORED;




All times are GMT -4. The time now is 22:40.

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