Added more mechanisms to prevent double msgs

This commit is contained in:
ChocoTaco 2019-01-19 14:58:42 -05:00
parent 25247ee91f
commit 13dfaa0809

View file

@ -24,6 +24,8 @@ function TeamBalanceNotify( %game, %client, %respawn )
$BalancedMsgPlayed = 0; $BalancedMsgPlayed = 0;
if( %Team1Difference >= 2 || %Team2Difference >= 2 ) if( %Team1Difference >= 2 || %Team2Difference >= 2 )
{
if( $StatsBalancedSoundPlayed !$= 1 )
{ {
if( $UnbalancedMsgPlayed !$= 1 && %Team2Difference == 2 || %Team1Difference == 2 ) if( $UnbalancedMsgPlayed !$= 1 && %Team2Difference == 2 || %Team1Difference == 2 )
{ {
@ -41,14 +43,16 @@ function TeamBalanceNotify( %game, %client, %respawn )
$StatsMsgPlayed = 1; $StatsMsgPlayed = 1;
} }
if( $StatsBalancedSoundPlayed !$= 1 )
{
//Called in 30 secs with sound //Called in 30 secs with sound
schedule(30000, 0, "StatsUnbalanceSound"); schedule(30000, 0, "StatsUnbalanceSound");
//Once per cycle. //Once per cycle.
$StatsBalancedSoundPlayed = 1; $StatsBalancedSoundPlayed = 1;
} }
} }
else if( $PlayerCount[1] !$= $PlayerCount[2] )
{
$StatsBalancedSoundPlayed = 0;
}
} }
//If teams are balanced and teams dont equal 0. //If teams are balanced and teams dont equal 0.
else if( $PlayerCount[1] == $PlayerCount[2] && $TotalTeamPlayerCount !$= 0 && $BalancedMsgPlayed !$= 1 ) else if( $PlayerCount[1] == $PlayerCount[2] && $TotalTeamPlayerCount !$= 0 && $BalancedMsgPlayed !$= 1 )