AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [error] duplication EventTeamScore (https://forums.alliedmods.net/showthread.php?t=273810)

Michell 10-26-2015 16:46

[error] duplication EventTeamScore
 
is having spoofing of events, how to fix?

PHP Code:

register_event("TeamScore""EventTeamScore""a"


PHP Code:

public EventTeamScore(){
        new 
team[32];
        
read_data(1,team,31);
       
        if (
equal(team,"CT"))
        {
                
iPonto] = read_data(2);
        }
        else if (
equal(team,"TERRORIST"))
        {
                
iPonto] = read_data(2);
        }
       
        if(
iLive){
               
                new 
SomaTempo iPonto] + iPonto]
                new 
SomaWinner iPonto] + iPrim]
                new 
SomaWinner2 iPonto] + iPrim]
                new 
SomaOverTime iPonto] + iOver]
                new 
SomaOverTime2 iPonto] + iOver]
               
               
                if(
iNorT){
                       
                        if(
SomaTempo  == 15){
                                
//troca time normal
                                //SomaTotalNormal()
                               
                                
FragMeio Frager();    
                                
MaisFraguer1 get_user_frags(FragMeio)
                               
                                
SomaPriTempo()
                               
                                
Tempo++
                                
set_task(3.0,"TrocaLado")
                               
                        }
                        if(
SomaWinner  == 16){
                                
//Aviso de Ganhador
                                //SomaTotalNormal()
                               
                                
FragFinal Frager();
                                
MaisFraguer2 get_user_frags(FragFinal)
                               
                                
//CT WIN
                                
CTWins()
                                
Resultado()
                                
set_task(3.0,"Fun")
                                
set_task(5.0,"MaisFrg")
                                
set_task(15.0,"ServerVoteMap")
                               
                        }
                        if(
SomaWinner2  == 16){
                                
//Aviso de Ganhador
                                //SomaTotalNormal()
                               
                                
FragFinal Frager();
                                
MaisFraguer2 get_user_frags(FragFinal)
                               
                                
//TR WIN
                                
TRWins()
                                
Resultado()
                                
set_task(3.0,"Fun")
                                
set_task(5.0,"MaisFrg")
                                
set_task(15.0,"ServerVoteMap")
                        }
                        if(
SomaWinner == 15 && SomaWinner2 == 15){
                                
//TrocaLado()
                                //SomaTotalNormal()
                               
                                
if(get_pcvar_num(VarMD3) == 1){
                                       
                                        
FragFinal Frager()
                                        
MaisFraguer2 get_user_frags(FragFinal)
                                       
                                        
EmpateFinal()
                                        
set_task(3.0,"Fun")
                                        
set_task(5.0,"MaisFrg")
                                        
set_task(15.0,"ServerVoteMap")
                                       
                                       
                                }
                                else if(
get_pcvar_num(VarMD3) != 1){
                                       
                                        
FragFinal Frager()
                                        
MaisFraguer2 get_user_frags(FragFinal)
                                       
                                        
SomaPriSegTempo()
                                        
Empate()
                                        
OverTime()
                                        
set_task(3.0,"TrocaLado")
                                }
                               
                        }
                }
                if(
iOvT){
                        if(
SomaTempo == 3){
                                
//troca time Over
                                //SomaTotalNormal()
                               
                                
FragMeioOver Frager();
                                
MaisFraguerOT2 get_user_frags(FragMeioOver)
                               
                                
SomaPriOver()
                               
                                
Tempo++
                                
set_task(3.0,"TrocaLado")
                        }
                        if(
SomaOverTime == 4){
                                
//aviso do ganhador
                                //SomaTotalNormal()
                               
                                
FragFinalOver Frager();
                                
MaisFraguerOT1  get_user_frags(FragFinalOver)
                               
                                
//CT WIN
                                
CTWinsOT()
                                
ResultadoOT()
                                
set_task(3.0,"Fun")
                                
set_task(5.0,"MaisFrg")
                                
set_task(5.0,"MaisFrgOT")
                                
set_task(15.0,"ServerVoteMap")
                        }
                        if(
SomaOverTime2 == 4){
                                
//Aviso do Ganhador
                                //SomaTotalNormal()
                               
                                
FragFinalOver Frager();
                                
MaisFraguerOT1  get_user_frags(FragFinalOver)
                               
                                
//TR WIN
                                
TRWinsOT()
                                
ResultadoOT()
                                
set_task(3.0,"Fun")
                                
set_task(5.0,"MaisFrg")
                                
set_task(5.0,"MaisFrgOT")
                                
set_task(15.0,"ServerVoteMap")
                        }
                        if(
SomaOverTime == && SomaOverTime2 == 3){
                                
//empate
                                //SomaTotalNormal()
                               
                                
FragFinalOver Frager();
                                
MaisFraguerOT1  get_user_frags(FragFinalOver)
                               
                                
// EMPATE      
                                
EmpateOT()
                                
ResultadoOT()
                                
set_task(3.0,"Fun")
                                
set_task(5.0,"MaisFrg")
                                
set_task(5.0,"MaisFrgOT")
                                
set_task(15.0,"ServerVoteMap")
                               
                        }
                }
        }



Bugsy 10-26-2015 18:13

Re: [error] duplication EventTeamScore
 
Are you sure you do not have 2 of the same plugins running? Maybe a test version and another version? Check your plugins.ini to be sure. If you want faster help, post code that I can paste in an IDE and compile without having to create a list of variables and things.

In the past I've spent time wondering why something wasn't working only to find out I either didn't enable the plugin in plugins.ini, or I had something else running that counteracted it.

Michell 10-26-2015 18:17

Re: [error] duplication EventTeamScore
 
not have two plugins in plugins.ini
the original code and this.

Bugsy 10-26-2015 18:41

Re: [error] duplication EventTeamScore
 
The message is sent two times, one time for each team. Doing a simple test you could figure this out yourself.
PHP Code:

public EventTeamScore(){
    new 
team[32];
    
read_data(1,team,31);
    
server_print"TEAMSCORE=%s"team ); 

Output
Code:

TEAMSCORE=CT
TEAMSCORE=TERRORIST


Michell 10-27-2015 19:13

Re: [error] duplication EventTeamScore
 
thank you...

Michell 10-27-2015 21:11

Re: [error] duplication EventTeamScore
 
still there is duplication ...

Bugsy 10-27-2015 21:21

Re: [error] duplication EventTeamScore
 
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
        
}
    }



Michell 10-27-2015 21:36

Re: [error] duplication EventTeamScore
 
sometimes it runs right, but when changing map, there begins another mix and mix it at the end of the this error.
I will test this other code.


All times are GMT -4. The time now is 17:55.

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