[Help] Radio issue
This plugin play sounds when the round start and ends it works fine but the problem when someone use the radio "Go" it plays a random sound.
round_sound_advanced.sma
PHP Code:
#include < amxmodx > #include < amxmisc > #tryinclude "round_sounds_advanced.cfg" #pragma semicolon 1 //Plugin registration new const PLUGIN_NAME [ ] = "Round Sounds Advanced", PLUGIN_VERSION [ ] = "1.2", PLUGIN_AUTHOR [ ] = "CryWolf"; // pCvar Pointers new pCvar_endsound, pCvar_beginsound, g_radiofix; public plugin_precache ( ) { pCvar_beginsound = register_cvar ( "amxx_bsounds", "1" ); pCvar_endsound = register_cvar ( "amxx_esounds", "1" ); new i, path [ 128 ]; if ( get_pcvar_num ( pCvar_beginsound ) ) { for ( i = 0; i < sizeof g_begun_sounds; i++ ) { if ( contain ( g_begun_sounds [ i ], ".wav" ) > 0 ) { precache_sound ( g_begun_sounds [ i ] ); } else if ( contain ( g_begun_sounds [ i ], ".mp3" ) > 0 ) { formatex ( path, charsmax ( path ), "sound/%s", g_begun_sounds [ i ]); precache_generic ( path ); } } } if ( get_pcvar_num ( pCvar_endsound ) ) { for ( i = 0; i < sizeof g_ct_win_sounds; i++ ) { if ( contain ( g_ct_win_sounds [ i ], ".wav" ) > 0 ) { precache_sound ( g_ct_win_sounds [ i ] ); } else if ( contain ( g_ct_win_sounds [ i ], ".mp3" ) > 0 ) { formatex ( path, charsmax ( path ), "sound/%s", g_ct_win_sounds [ i ] ); precache_generic ( path ); } } for ( i = 0; i < sizeof g_te_win_sounds; i++ ) { if ( contain ( g_te_win_sounds [ i ], ".wav" ) > 0 ) { precache_sound ( g_te_win_sounds [ i ] ); } else if ( contain ( g_te_win_sounds [ i ], ".mp3" ) > 0 ) { formatex ( path, charsmax ( path ), "sound/%s", g_te_win_sounds [ i ] ); precache_generic ( path ); } } } } public plugin_init ( ) { register_plugin ( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR ); register_message ( get_user_msgid ( "SendAudio" ), "FunC_MSG_SendAudio" ); } public FunC_MSG_SendAudio ( msgid, dest, id ) { static audiocode [ 26 ]; get_msg_arg_string ( 2, audiocode, charsmax ( audiocode ) ); if( get_pcvar_num ( pCvar_beginsound ) ) { if ( equal ( audiocode [ 7 ], "MOVEOUT" ) || equal ( audiocode [ 7 ], "LOCKNLOAD" ) || equal ( audiocode [ 7 ], "LETSGO" ) || ( equal ( audiocode [ 7 ], "GO" ) && !g_radiofix ) ) { set_msg_arg_string ( 2, "%!MRAD_ELIM" ), g_radiofix = false; g_radiofix = false; new i = random ( sizeof ( g_begun_sounds ) ); PlaySoundToClients ( g_begun_sounds [ i ] ); return 1; } } if ( equal ( audiocode [ 7 ], "terwin" ) && get_pcvar_num ( pCvar_endsound ) ) { new i = random ( sizeof ( g_te_win_sounds ) ); PlaySoundToClients ( g_te_win_sounds [ i ] ); return 1; } else if ( equal ( audiocode [ 7 ], "ctwin" ) ) { new i = random ( sizeof ( g_ct_win_sounds ) ); PlaySoundToClients ( g_ct_win_sounds [ i ] ); return 1; } return 0; } public cmd_fixradio ( ) { g_radiofix = true; } PlaySoundToClients ( const sound [ ] ) { if ( equal ( sound [ strlen ( sound ) -4 ], ".mp3" ) ) client_cmd ( 0, "mp3 play ^"sound/%s^"", sound ); else client_cmd ( 0, "spk ^"%s^"", sound ); }
round_sound_advanced.cfg
PHP Code:
/* Round Sounds Advanced v1.0 by CryWolf Info: Pentru a adauga mai multe sunete adaugati o virgula dupa ultimele ghilimele si adaugati mai departe gen: new const g_begun_sounds [ ] [ ] = { "misc/begun1.mp3", "misc/begun2.wav", "misc/begun3.wav", "misc/begun4.wav", "misc/begun5.wav", "misc/begun6.wav" }; ATENTIE! Ultimul rand nu trebuie sa aiba virgulita! ATENTIE! Acest fisier trebuie sa fie in folderul "scripting" langa .sma-ul "round_sounds_advanced.sma" astfel pluginul nu se va compila! */ // Sunetele de la inceput de runda :) // Format .MP3 si .WAV new const g_begun_sounds [ ] [ ] = { "misc/begun1.mp3", "misc/begun2.wav" }; // Sunetele cand echipa Counter-Terrorist este castigatoarea :) // Format .MP3 si .WAV new const g_ct_win_sounds [ ] [ ] = { "misc/win_ct1.wav", "misc/win_ct1.mp3" }; // Sunetele cand echipa Terrorist este castigatoarea :) // Format .MP3 si .WAV new const g_te_win_sounds [ ] [ ] = { "misc/te_win1.mp3", "misc/te_win1.wav" };
|