Raised This Month: $ Target: $400
 0% 

[error] duplication EventTeamScore


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-27-2015 , 21:21   Re: [error] duplication EventTeamScore
Reply With Quote #7

You can do something like this, which will make it only fire your code once. Just be aware that you will not get the other teams score info. Whichever team the message is sent for first is the only one you will get.
PHP Code:
new g_LastTeamScoreCall;

public 
EventTeamScore()
{
    new 
iSysTime;
    
    if ( ( ( 
iSysTime get_systime() ) - g_LastTeamScoreCall ) < )
        return;
        
    new 
szTeam];
    
read_dataszTeam charsmaxszTeam ) );
    
    
//Code goes here

    
g_LastTeamScoreCall iSysTime;

I imagine that is not what you want since you are using both teams scores.

Try something like this. In this case, the code where you see '//Code for CT ' and '//Code for T' will only be fired one time. Anything outside of the switch statement will run twice.
PHP Code:
public EventTeamScore()
{
    new 
szTeam] , iScore;
    
    
read_dataszTeam charsmaxszTeam ) );
    
iScore read_data);
    
    switch ( 
szTeam] )
    {
        case 
'C':
        {
            
//Code for CT 
        
}
        case 
'T':
        {
            
//Code for T
        
}
    }

__________________

Last edited by Bugsy; 10-27-2015 at 21:23.
Bugsy 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 17:55.


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