I got this code from some archived post:
https://forums.alliedmods.net/archiv...p/t-53052.html
The code starts playing the defined sound after each new round start...all fine,
the problem is that the sound file i added works as an background music.
That ambience sound lasts about 3 min,if the round ends in 30 sec it will continue playing and another sample of the same ambience will start playing with new round start.
What can i add to the code so that round start sound stops right before starting a new round??
Code as of now:
PHP Code:
#include <amxmodx>
new const lstSound[][] = { "misc/predatortheme.wav" };
new bool:g_handle_round_end;
public plugin_init()
{
register_plugin( "Round Start Sound", "1.0", "AMXX Community" );
register_event( "HLTV", "event_new_round", "a", "1=0", "2=0" );
register_logevent("EventRoundEnd", 2, "1=Round_End");
}
public plugin_precache()
{
new CurSnd[128];
copy( CurSnd, 127, lstSound[0] );
format( CurSnd, 127, "sound/%s", CurSnd );
if ( equali( CurSnd[strlen(CurSnd)-4], ".mp3" ) )
{
if ( file_exists( CurSnd ) )
precache_generic( CurSnd );
}
else
{
if ( file_exists( CurSnd ) )
precache_sound( CurSnd[6] );
}
}
public event_new_round()
{
new CurSnd[128];
copy( CurSnd, 127, lstSound[0] );
format( CurSnd, 127, "sound/%s", CurSnd );
if( equali( CurSnd[strlen( CurSnd ) - 4 ], ".mp3" ) )
client_cmd( 0, "mp3 play %s", CurSnd )
else
client_cmd( 0, "spk %s", CurSnd[6] )
}
public EventRoundEnd()
{
if( !g_handle_round_end ) return;
g_handle_round_end = false;
client_cmd (CurSnd , "stopsound" )
}
I ony added:
PHP Code:
new bool:g_handle_round_end;
register_logevent("EventRoundEnd", 2, "1=Round_End");
and
public EventRoundEnd()
{
if( !g_handle_round_end ) return;
g_handle_round_end = false;
client_cmd (CurSnd , "stopsound" )
}
to the original code but im getting the following errors:
Warning: Loose indentation on line 52
Error: Undefined symbol "CurSnd" on line 52
Warning: Expression has no effect on line 52
Error: Expected token: ";", but found ")" on line 52
Error: Invalid expression, assumed zero on line 52
Error: Too many error messages on one line on line 52
What im doing wrong,can you guys help me out??
Thanks everyone
Edu