editar para que suenan solo los sonidots de ct y suenen para los dos bandos
#1
alguien me podria estar el plugin para que solo suenen las musica de ct y que suenen para los dos bando osea ct y tt asi para no subir tambien los sound de tt


Código PHP:
/* - - - - - - - - - - -

        AMX Mod X script.
        Copyright (C) 2007 - Arkshine

        Plugin  : 'Alternative End Round Sounds'
        Version :  v2.3b

        Original idea and plugin by PaintLancer.
        Orignal thread : http://forums.alliedmods.net/showthread.php?t=6784
        
        This program is free software; you can redistribute it and/or modify it
        under the terms of the GNU General Public License as published by the
        Free Software Foundation; either version 2 of the License, or (at
        your option) any later version.

        This program is distributed in the hope that it will be useful, but
        WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
        General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software Foundation,
        Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

        In addition, as a special exception, the author gives permission to
        link the code of this program with the Half-Life Game Engine ("HL
        Engine") and Modified Game Libraries ("MODs") developed by Valve,
        L.L.C ("Valve"). You must obey the GNU General Public License in all
        respects for all of the code used other than the HL Engine and MODs
        from Valve. If you modify this file, you may extend this exception
        to your version of the file, but you are not obligated to do so. If
        you do not wish to do so, delete this exception statement from your
        version.

        ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
        
        Description :
        - - - - - - -
            Plays random music at the end of a round according to who wins,
            instead of just "Terrorists Win" or "Counter-Terrorists Win".

            
        Features :
        - - - - - -
            * Support for mp3 and wav files
            * Using a file for the sounds
            * Per-map config files supported
            * Per-map prefix config files supported
            * Sounds can be toggle on/off by players
            * Ability to choice x sounds to be precache per map
            * Multilingual support

            
        Requirements :
        - - - - - - - -
            * CS 1.6 / CZ
            * AMX/X 1.7x or higher

            
        Cvars :
        - - - -
            * ers_enabled <iNum
            
                <0|1> Disable/Enable this plugin. 
                (default: 1)
            
            
            * ers_player_toggle <iNum>
            
                <0|1> Disable/Enable the client command /roundsound 
                (default: 1)
                
                
            * erc_time_ads <iTime>
            
                Times in seconds between each ads messages. 0 disable ads. 
                (default: 120)

                
            * erc_random_precache <iMaxTeam or iMax_T-iMax_CT>

                Specify how many sounds by team you want to precache randomly among all sounds.
                This means that x sounds will be choosen randomly among all sounds of each team so to be precache at each map. ( 0 = disable feature )
                
                e.g : erc_random_precache "2"   : 2 sounds will be choosen among all CTs sounds and all Ts sounds
                      erc_random_precache "2-3" : 2 Ts sounds will be choosen randomly among all Ts sounds.
                                                  3 CT sound will be choosen randomly among all CTs sounds.
                                                  /!\ Don't forget to insert '-' .
                                                  
                /!\ Map change on cvar change required !

                
        Client command :
        - - - - - - - - 
            * say /roundsound : Give to players the ability to turn on/off the end round sounds

            
        Changelog :
        - - - - - -

            -> Arksine :

             v3.0  - [ 2007-xx-xx ] ( Major update )

                      - Soon. A lot of changes/new features. Huge update. ;)

             v2.3b - [ 2007-11-22 ]
                
                      (!) Fixed a compatibility bug from 2.3a version.
                        
             v2.3a - [ 2007-11-19 ]

                      (+) Added compatibility for Amxx 1.7x.
                      (!) Now 'erc_random_precache' cvar is set to 0 by default.
                      (!) Fixed. At the first start of server, value from 'erc_random_precache' cvar from a config file was not read.
                      (!) Some others minors changes.

             v2.3  - [ 2007-10-29 ]

                      (+) Added 'erc_random_precache' cvar : Specify how many sounds per team you want to precache randomly among all sounds.
                          This means that x sounds will be choosen randomly among all sounds of each team so to be precache at each map. ( request by Arion )
                      (!) Debug mode is enabled by default now.
                      (-) Removed 3 keys languages. No more need.( ERS_LOG_TOTAL_SOUND_LOADED, ERS_LOG_DEBUG_T, ERS_LOG_DEBUG_CT )

             v2.2b - [ 2007-10-28 ]

                      (!) Removed a check. Since trim() is used :
                          Now no need to check space, new line, tabs, carriage returns, etc..

             v2.2a - [ 2007-10-28 ]

                      (!) Changed the method of checking empty file. Now it's more efficient.
                      (!) Added another check to ignore texts which are no comments.
                      (!) Fixed a typo ( key language ).

             v2.2  - [ 2007-10-27 ]

                      (+) Added a check to prevent to get a warning when a team has no sound.
                      (+) Added a check to prevent to not load empty file.
                      (+) Added support for coding-style '//' comments.
                      (!) No longer has a predefined max sounds limit. ( using dynamic array from amxx 1.8.0 )
                      (!) Minors optimizations.
                      (-) Removed useless code.

             v2.1a - [ 2007-07-13 ]

                      (!) Fixed a bug with ML system.
                      (!) Fixed a stupid glitch with formatex().

             v2.1  - [ 2007-07-06 ]

                      (!) Optimize a little.
                      (!) Rewritted loading_file() function.
                      (+) Added ML system & some texts.
                      (+) Added Color in text. ( !g = green ; !t = team color; !n = yellow (normal) )
                      (+) Added #_DEBUG.
                      (+) Added chat command : toggle on/off end round sounds.
                      (+) Added "ers_enabled" cvar : enable/disable plugin
                      (+) Added "ers_player_toggle" cvar : enable/disabled command chat for players
                      (+) Added ads message for chat command
                      (+) Added "erc_time_ads" cvar : control amount of times between 2 messages.

             v2.0b - [ 2007-07-04 ]

                      (!) No features added. Sma reorganized a little and more.

             v2.0a - [ 2007-06-26 ]

                      (!) Fixed. Bug under linux. Some blank lines weren't ignored. (thanks Deejay & NiLuje)

             v2.0  - [ 2007-06-26 ]

                      (!) Totaly rewritten.
                      (+) Added support for mp3 files.
                      (+) Added support per file. No more to edit .sma file to add sounds.
                      (+) Added support per-map file.
                      (+) Added support per-map prefix file.

            -> Paintlancer :

             v1.0  :  [ 2004-10-14 ]
                      First release by Paintlancer.
                      Orignal thread : http://forums.alliedmods.net/showthread.php?t=6784

        Credits:
        - - - - - - -
            * PaintLancer : Original idea and plugin.
            * Avalanche   : Inspired color chat function from gungame plugin.
            * Arion       : Random precache idea.
            
            * Languages translation :
                - [fr] : Arkshine
                - [de] : Mordekay
                - [es] : Darkless
        

    - - - - - - - - - - - */

    #include <amxmodx>
    #include <amxmisc>
    #include <fakemeta>


        
new const
    
// _________________________________________________

            
PLUGIN [] = "Alternative End Round Sounds",
            
VERSION[] = "2.3c",
            
AUTHOR [] = "Arkshine";
    
// _________________________________________________


    #if AMXX_VERSION_NUM < 180
        #define old_amxx
    #endif


    /* ========================= [ "START" AERA FOR CHANGES ] ========================= */


        #define _DEBUG                 // Active debug
        #define MAX_FILE_LENGTH  196   // Max length for files + path.

        #if defined old_amxx
            #define MAX_SOUNDS    25   // Max sounds per team
        #endif

        
new const

            
g_FileName[]    = "roundsound",     // Name of the main file if no files is found in 'g_FileFolder'.
            
g_FileFolder[]  = "round_sound",    // Name of the directory in amxmodx/configs/ for per-map files.
            
g_FilePrefix[]  = "ini",            // File extension used for the files.
            
g_CmdChat[]     = "/roundsound";    // Chat command for player.


    /* ========================= [ "END" AERA FOR CHANGES ] ========================= */



    // - - - - - - - - - - - - - - - - - - - - - - -

    #define MAX_PLAYERS  32
    #define TASKID_ADS   1333
    #define SIZE_FILE    0
    #define NULL        -1

    
new
        
bool:g_pHeardSoundMAX_PLAYERS ],

        
#if !defined old_amxx
            
Array:g_lstSoundCT,
            Array:
g_lstSoundT,
        
#endif

        
p_enabled,
        
p_player_toggle,
        
p_time_ads,
        
p_random_precache,
        
        
g_msgSayText;


    
enum _:e_Team
    
{
        
0,
        
CT,
    };

    new 
g_nSnde_Team ];

    
#if defined old_amxx
        
new g_sTeam_soundsMAX_SOUNDS ][ e_Team ][ MAX_FILE_LENGTH ];
        
#define charsmax(%1)  sizeof( %1 ) - 1
    #endif

    #define _is_wav(%1)  equali( %1[strlen( %1 ) - 4 ], ".wav" )

    // - - - - - - - - - - - - - - - - - - - - - - -


    
public plugin_init()
    {
        
register_pluginPLUGINVERSIONAUTHOR );
        
register_cvar"ers_version"VERSIONFCVAR_SERVER FCVAR_SPONLY );
        
        
register_dictionary"end_roundsound.txt" );

        
register_event"SendAudio""eT_win" "a""2&%!MRAD_terwin" );
        
register_event"SendAudio""eCT_win""a""2&%!MRAD_ctwin"  );

        
p_enabled         register_cvar"ers_enabled"        "1"   );
        
p_random_precache register_cvar"erc_random_precache""0"   );
        
p_player_toggle   register_cvar"ers_player_toggle"  "1"   );
        
p_time_ads        register_cvar"erc_time_ads"       "120" );

        
register_clcmd"say"       "cmd_Say" );
        
register_clcmd"say_team"  "cmd_Say" );

        
PluginPrecache ();
    }
    
    
    
PluginPrecache ()
    {
        
#if !defined old_amxx
            
g_lstSoundCT ArrayCreateMAX_FILE_LENGTH );
            
g_lstSoundT  ArrayCreateMAX_FILE_LENGTH );
        
#endif

        
loading_file();
    }
    
    
    public 
plugin_cfg ()
    {
        
g_msgSayText get_user_msgid"SayText" );
    }

 
    public 
client_authorizedid )
        
g_pHeardSound[id] = true;


    public 
client_disconnectid )
    {
        
g_pHeardSound[id] = true;
        
remove_taskid TASKID_ADS );
    }


    public 
client_putinserverid )
    {
        new 
Float:time get_pcvar_floatp_time_ads );

        if( !
time )
            return;

        
remove_taskid TASKID_ADS );
        
set_tasktime"show_ads"id TASKID_ADS__"b" );
    }


    public 
show_adstaskid )
    {
        new 
id taskid TASKID_ADS;
        
ShowPrintid"%L"id"ERS_DISPLAY_ADS"g_CmdChat );
    }


    public 
cmd_Sayid )
    {
        if( !
get_pcvar_nump_enabled ) )
            return 
PLUGIN_CONTINUE;

        static 
sMsg[64];
        
read_argv1sMsgcharsmaxsMsg ) );

        if( 
equalisMsgg_CmdChat ) )
        {
            if( !
get_pcvar_nump_player_toggle ) )
            {
                
ShowPrintid"%L"id"ERS_CMD_DISABLED" );
                return 
PLUGIN_HANDLED;
            }

            
g_pHeardSound[id] = g_pHeardSound[id] ? false true;
            
ShowPrintid"%L"idg_pHeardSound[id] ? "ERS_SOUND_ENABLED" "ERS_SOUND_DISABLED" );

            return 
PLUGIN_HANDLED;
        }

        return 
PLUGIN_CONTINUE;
    }


    public 
eT_win()
    {
        if( !
g_nSnde_Team:] )
            return;

        
play_sounde_Team:);
    }


    public 
eCT_win()
    {
        if( !
g_nSnde_Team:CT ] )
            return;

        
play_sounde_Team:CT );
    }


    
play_soundiTeam )
    {
        static
    
//  - - - - - - - - - - - - - - - -
            
sCurSndMAX_FILE_LENGTH ];
    
//  - - - - - - - - - - - - - - - -

        
new iRand;

        if( 
g_nSndiTeam ] > )
            
iRand random_num0g_nSndiTeam ] - );

        
#if defined old_amxx
            
copysCurSndMAX_FILE_LENGTH 1g_sTeam_soundsiRand ][ iTeam ] );
        
#else
            
ArrayGetStringiTeam == CT g_lstSoundCT g_lstSoundTiRandsCurSndMAX_FILE_LENGTH );
        
#endif

        
_is_wavsCurSnd ) ?

             
formatsCurSndMAX_FILE_LENGTH 1"spk %s"sCurSnd[6] ) :
             
formatsCurSndMAX_FILE_LENGTH 1"mp3 play %s"sCurSnd );

        if( 
get_pcvar_nump_player_toggle ) )
        {
            static
        
//  - - - - - - - - - - -
                
iPlayers[32],
                
iNumpid;
        
//  - - - - - - - - - - -

            
get_playersiPlayersiNum"c" );

            for( new 
iiNumi++ )
            {
                
pid iPlayers[i];

                if( !
g_pHeardSound[pid] || is_user_botpid ) )
                    continue;

                
client_cmdpid"%s"sCurSnd );
            }
        }
        else
            
client_cmd0"%s"sCurSnd );
    }


    
get_prefixsMap[], iLen_mapsMapType[], iLen_type )
    {
        new
    
//  - - - - - - - - -
            
sRest[32];
    
//  - - - - - - - - -

        
get_mapnamesMapiLen_map );
        
strtoksMapsMapTypeiLen_typesRestcharsmaxsRest ), '_');
    }


    
loading_file()
    {
        static
    
//  - - - - - - - - - - - - - - - - -
            
sPathMAX_FILE_LENGTH ],
    
//      |
            
sConfigsDir[64],
            
sPrefix[6],
            
sMap[32];
    
//  - - - - - - - - - - - - - - - - -

        
get_prefixsMapcharsmaxsMap ), sPrefixcharsmaxsPrefix ) );
        
get_configsdirsConfigsDircharsmaxsConfigsDir ) );


        new 
bool:bFound;

        for( new 
1<= 3i++ )
        {
            switch( 
)
            {
                case 
formatexsPathcharsmaxsPath ), "%s/%s/prefix-%s.%s"sConfigsDirg_FileFoldersPrefixg_FilePrefix );
                case 
formatexsPathcharsmaxsPath ), "%s/%s/%s.%s"sConfigsDirg_FileFoldersMapg_FilePrefix );
                case 
formatexsPathcharsmaxsPath ), "%s/%s.%s"sConfigsDirg_FileNameg_FilePrefix );

                default : break;
            }

            if( !
CheckFilesPath ) )
                continue;

            
bFound true;
            break;
        }

        
log_amx"---" );

        
bFound ?
            
log_amx"%L"LANG_SERVER"ERS_LOG_LOADING"sPath ) :
            
log_amx"%L"LANG_SERVER"ERS_LOG_NO_FILES_FOUND" );

        
load_soundsPath );
    }

    
    
load_sound( const file[] )
    {
        new
    
//  - - - - - - - - - - - - - - -
            
sBuffer[256],
    
//      |
            
sLeftMAX_FILE_LENGTH ],
            
sRight[4],
            
sExt[6],
    
//      |
            
eTeam;
    
//  - - - - - - - - - - - - - - -

        
new fp fopenfile"rt" );

        while( !
feoffp ) )
        {
            
fgetsfpsBuffercharsmaxsBuffer ) );

            
trimsBuffer );

            if( !
sBuffer[0] || sBuffer[0] == ';' || ( sBuffer[0] == '/' && sBuffer[1] == '/' ) )
                continue;

            if( 
sBuffer[0] != '"' || strlensBuffer  ) < 11 )
                continue;

            
parsesBuffersLeftcharsmaxsLeft ), sRightcharsmaxsRight ) );
            
formatexsExtcharsmaxsExt ), sLeftstrlensLeft ) - ] );

            if( 
equalisExt".mp3" ) == -|| equalisExt".wav" ) == -)
            {
                
log_amx"%L"LANG_SERVER"ERS_LOG_UNKNOW_EXTENSION"sExt );
                continue;
            }

            if( !
file_existssLeft ) )
            {
                
log_amx"%L"LANG_SERVER"ERS_LOG_INEXISTENT_FILE"sLeft );
                continue;
            }

            
eTeam NULL;

            if( 
equalisRight"CT" ) )
                
eTeam CT;

            else if( 
equalisRight"T" ) )
                
eTeam T;

            if( 
eTeam == NULL )
            {
                
log_amx"%L"LANG_SERVER"ERS_LOG_NO_TEAM_SOUND"sLeft );
                continue;
            }

            
#if defined old_amxx
                
copyg_sTeam_soundsg_nSndeTeam ] ][ eTeam ], MAX_FILE_LENGTH 1sLeft );
            
#else
                
ArrayPushStringeTeam == CT g_lstSoundCT g_lstSoundTsLeft );
            
#endif

            
++g_nSndeTeam ];
        }
        
fclosefp );

        if( 
g_nSnde_Team:] > || g_nSnde_Team:CT ] > )
        {
                new 
iMax_tiMax_ct;
                
GetPrecacheValueiMax_tiMax_ct );

                
#if defined old_amxx
                    
UpdateArrayiMax_te_Team:);
                    
UpdateArrayiMax_cte_Team:CT );
                
#else
                    
p_DeleteRandomItemiMax_t e_Team:g_lstSoundT  );
                    
p_DeleteRandomItemiMax_cte_Team:CTg_lstSoundCT );
                
#endif
        
}

        
log_amx"---" );

        
#if defined _DEBUG
            
log_amx"[ Loading %d CTs Sounds ]"g_nSnde_team:CT ] );
        
#endif
        #if defined old_amxx
            
PrecacheSoundse_Team:CT );
        
#else
            
PrecacheSounds_ng_lstSoundCT );
        
#endif

        #if defined _DEBUG
             
log_amx"[ Loading %d Ts Sounds ]"g_nSnde_team:] );
        
#endif
        #if defined old_amxx
            
PrecacheSoundse_Team:);
        
#else
            
PrecacheSounds_ng_lstSoundT );
        
#endif
    
}


    
GetPrecacheValue( &iMax_t, &iMax_ct )
    {
        new 
s_Value[12];
        
get_pcvar_stringp_random_precaches_Valuecharsmaxs_Value ) );
        
        
trims_Value );
        new 
pos contains_Value"-" );

        if( 
pos )
        {
            
iMax_ct str_to_nums_Valuepos ] )
            
s_Valuepos ] = '^0';
            
iMax_t str_to_nums_Value );
        }
        else
        {
            
iMax_t  str_to_nums_Value );
            
iMax_ct iMax_t;
        }
    }

    
    
stock UpdateArrayiMaxiTeam )
    {
        new const 
iCnt_sound g_nSndiTeam ];
            
        if( !
iMax || iMax == iCnt_sound )
            return;

        if( 
iMax >= iCnt_sound )
            
iMax iCnt_sound 1;

        static
            
sTmp_soundsMAX_SOUNDS ][ e_Team ][ MAX_FILE_LENGTH ],
            
iLast_numberMAX_SOUNDS ];

        new 
iiRand;
        for( 
0iCnt_soundi++ )
        {
            
copysTmp_sounds[i][ iTeam ], MAX_FILE_LENGTH 1g_sTeam_sounds[i][ iTeam ] );
            
g_sTeam_sounds[i][ iTeam ][0] = '^0';
        }

        
arraysetiLast_number0charsmaxiLast_number ) );

        
0;
        while( 
!= iMax )
        {
            
check:
            
iRand random_num0iCnt_sound );

            if( 
iLast_numberiRand ] )
                goto 
check;

            
copyg_sTeam_sounds[i][ iTeam ], MAX_FILE_LENGTH 1sTmp_soundsiRand ][ iTeam ] );
            ++
i;
                
            
iLast_numberiRand ] = 1;
        }

        
g_nSndiTeam ] = iMax;
    }
    

    
stock p_DeleteRandomItemiMaxiTeam, Array:sSound_a )
    {
        new const 
iCnt_sound g_nSndiTeam ];
            
        if( !
iMax || iMax == iCnt_sound )
            return;

        if( 
iMax >= iCnt_sound )
            
iMax iCnt_sound 1;

        
DeleteRandomItemiCnt_sound iMaxsSound_a );
        
g_nSndiTeam ] = iMax;
    }


    
stock DeleteRandomItemiRandom_n, Array:sSound_a )
        {
            new 
i;

            while( 
i++ != iRandom_n )
                
ArrayDeleteItemsSound_arandom_num0ArraySizesSound_a ) - ) );
        }

        
    
stock PrecacheSoundsiTeam )
    {
        for( new 
ig_nSndiTeam ]; i++ )
        {
            
PrecacheFileg_sTeam_sounds[i][ iTeam ] );

            
#if defined _DEBUG
                
log_amx"   - %s"g_sTeam_sounds[i][ iTeam ] );
            
#endif
        
}

        
log_amx"---" );
    }


    
stock PrecacheSounds_n( Array:sSound_a )
    {
        static
    
//  - - - - - - - - - - - - - - - - - - -
            
sFileMAX_FILE_LENGTH ],
            
iFileLen charsmaxsFile );
    
//  - - - - - - - - - - - - - - - - - - -

        
for( new iArraySizesSound_a ); i++ )
        {
            
ArrayGetStringsSound_aisFileiFileLen );
            
PrecacheFilesFile );

            
#if defined _DEBUG
                
log_amx"   - %s"sFile );
            
#endif
        
}

         
log_amx"---" );
    }


    
PrecacheFile( const sound[] )
    {
        
_is_wavsound ) ?

            
engfunc EngFunc_PrecacheSoundsound[6] ) :
            
engfunc EngFunc_PrecacheGenericsound );
    }


    
ShowPrintid, const sMsg[], { FloatSqlResult}:... )
    {
        static
    
//  - - - - - - - - -
            
newMsg[191],
            
message[191],
    
//      |
            
tNewMsg;
    
//  - - - - - - - - -

        
tNewMsg charsmaxnewMsg );
        
vformatnewMsgtNewMsgsMsg);

        
replace_allnewMsgtNewMsg"!t""^3" );
        
replace_allnewMsgtNewMsg"!g""^4" );
        
replace_allnewMsgtNewMsg"!n""^1" );

        
formatexmessagecharsmaxmessage ), "^4[ERS]^1 %s"newMsg );

        
message_beginMSG_ONEg_msgSayText_id );
        
write_byteid );
        
write_stringmessage );
        
message_end();
    }
    
    
    
bool:CheckFile( const file[] )
    {
        new
    
//  - - - - - - - - - - - - - - - - -
            
sBuffer[256],
            
fp fopenfile"rt" );
    
//  - - - - - - - - - - - - - - - - -

        
if( !fp )
            return 
false;

        while( !
feoffp ) )
        {
            
fgetsfpsBuffercharsmaxsBuffer ) );

            
trimsBuffer );

            if( !
sBuffer[0] || sBuffer[0] == ';' || ( sBuffer[0] == '/' && sBuffer[1] == '/' ) || sBuffer[0] != '"' )
                continue;

            if( ( 
containsBuffer".mp3^"" ) != -1 || contain( sBuffer, ".wav^"" ) != -) && ( containsBuffer"^"T^"" ) != -|| containsBuffer"^"CT^"" ) != -) )
                return 
true;
        }
        
fclosefp );

        return 
false;
    } 
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)