Raised This Month: $ Target: $400
 0% 

Solved Prevent background sound from overlapping between rounds


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
chuttenjr
Member
Join Date: Sep 2018
Location: Saipan
Old 09-27-2018 , 09:55   Prevent background sound from overlapping between rounds
Reply With Quote #1

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];

copyCurSnd127lstSound[0] );
formatCurSnd127"sound/%s"CurSnd ); 

if ( 
equaliCurSnd[strlen(CurSnd)-4], ".mp3" ) ) 
{
if ( 
file_existsCurSnd ) )
precache_genericCurSnd );
}
else 
{
if ( 
file_existsCurSnd ) )
precache_soundCurSnd[6] ); 
}
}

public 
event_new_round()
{
new 
CurSnd[128];

copyCurSnd127lstSound[0] );
formatCurSnd127"sound/%s"CurSnd ); 

if( 
equaliCurSnd[strlenCurSnd ) - ], ".mp3" ) )
client_cmd0"mp3 play %s"CurSnd )
else
client_cmd0"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

Last edited by chuttenjr; 09-29-2018 at 12:54.
chuttenjr is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:54.


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