AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Warning: Tag mismatch (https://forums.alliedmods.net/showthread.php?t=253613)

Snitch 12-25-2014 06:16

Warning: Tag mismatch
 
why Tag mismatch?
Code:

    for ( new i; i < iNum; i++ )
    {
        iPlayer = Players[ i ];
       
        if ( g_iGang[ iPlayer ] != g_iGang[ client ] )
            continue;
       
        ColorChat( iPlayer, GetTeamColor( cs_get_user_team( client ) ), "^3*^1%s^1[^3 %s ^1] %s^4 %s^1 :^3 %s", is_user_alive( client ) ? " " : "DEAD", aData[ GangName ], szStatus, szName( client ), szMsg );
    }

Code:

stock GetTeamColor( CsTeams:iTeam )
{
    switch ( iTeam )
    {
        case CS_TEAM_CT:    return BLUE;
       
        case CS_TEAM_T:        return RED;
       
        case CS_TEAM_SPECTATOR:    return GREY;
    }
   
    return GREEN;
}

Lines tag mismatch:
Code:

case CS_TEAM_CT:    return BLUE;
case CS_TEAM_T:        return RED;
case CS_TEAM_SPECTATOR:    return GREY;

return GREEN;


RateX 12-25-2014 07:31

Re: Warning: Tag mismatch
 
Couldn't see the whole code through my phone, but try:
PHP Code:

CsTeams:cs_get_user_team 

:arrow:
PHP Code:

_:cs_get_user_team 

And remove CsTeams from your var

Snitch 12-25-2014 08:09

Re: Warning: Tag mismatch
 
Quote:

Originally Posted by RateX (Post 2239796)
Couldn't see the whole code through my phone, but try:
PHP Code:

CsTeams:cs_get_user_team 

:arrow:
PHP Code:

_:cs_get_user_team 

And remove CsTeams from your var

still tag mismatch

u mean:
Code:

stock GetTeamColor( CsTeams:iTeam )
:arrow:
Code:

stock GetTeamColor( iTeam )
it make more tag mismatch

can u explain?

and i tried:
Quote:

stock GetTeamColor( CsTeams:cs_get_user_team )
{
switch ( cs_get_user_team )
{
case CS_TEAM_CT: return BLUE;

case CS_TEAM_T: return RED;

case CS_TEAM_SPECTATOR: return GREY;
}

return GREEN;
}
still tag mismatch

HamletEagle 12-25-2014 12:24

Re: Warning: Tag mismatch
 
When I compile your code(with empty variables, just to test) I get no tag mistmatch and the above code should not give you one. Post the full code.

Snitch 12-25-2014 13:48

Re: Warning: Tag mismatch
 
No need full code that has lines that are not related to the subject.
PHP Code:

    if ( szMsg] != '~' )
        return 
0;
    
    
replaceszMsgcharsmaxszMsg ), "~""" );
    
    static 
Players32 ], iNumiPlayerszStatus32 ];
    
    
get_playersPlayersiNum );
    
    
formatexszStatuscharsmaxszStatus ), "*%s*",
    (
getStatusclientg_iGangclient ] ) == STATUS_OWNER) ? "Owner" : (getStatusclientg_iGangclient ] ) == STATUS_LEADER) ? "Leader" "Member" );
    
    for ( new 
iiNumi++ )
    {
        
iPlayer Players];
        
        if ( 
g_iGangiPlayer ] != g_iGangclient ] )
            continue;
        
        
ColorChatiPlayerGetTeamColorcs_get_user_teamclient ) ), "^3*^1%s^1[^3 %s ^1] %s^4 %s^1 :^3 %s"is_user_aliveclient ) ? " " "DEAD"aDataGangName ], szStatusszNameclient ), szMsg );
    }
    
    return 
1;
}


stock GetTeamColorCsTeams:iTeam )
{
    switch ( 
iTeam )
    {
        case 
CS_TEAM_CT:    return BLUE;
        
        case 
CS_TEAM_T:        return RED;
        
        case 
CS_TEAM_SPECTATOR:    return GREY;
    }
    
    return 
GREEN;



HamletEagle 12-25-2014 15:13

Re: Warning: Tag mismatch
 
Quote:

Originally Posted by HamletEagle (Post 2239902)
When I compile your code(with empty variables, just to test) I get no tag mistmatch and the above code should not give you one. Post the full code.


klippy 12-25-2014 16:32

Re: Warning: Tag mismatch
 
Look at ColorChat() function prototype. I am sure the second argument should be tagged, so GetTeamColor() should return a tagged value. Unfortunately, I don't remember which tag it is, so take a look at colorchat.inc.

Snitch 12-26-2014 02:19

Re: Warning: Tag mismatch
 
how. you dont get warning?

Quote:

Originally Posted by KliPPy (Post 2239973)
Look at ColorChat() function prototype. I am sure the second argument should be tagged, so GetTeamColor() should return a tagged value. Unfortunately, I don't remember which tag it is, so take a look at colorchat.inc.

i dont think it colorchat.

something worng with my writing.
TbI Explain in detail what needs to change and try

fysiks 12-26-2014 04:53

Re: Warning: Tag mismatch
 
Quote:

Originally Posted by Snitch (Post 2240109)
how. you dont get warning?


i dont think it colorchat.

something worng with my writing.
TbI Explain in detail what needs to change and try

If you get the tag mismatch and he doesn't, that means you have different color chat include files and it is, in fact, caused by this difference (assuming he tested the exact code that you posted).

HamletEagle 12-26-2014 04:54

Re: Warning: Tag mismatch
 
I get no warning when compiling your code with a random colorchat include. If you don't want to post your full code give us at least your colorchat.inc


All times are GMT -4. The time now is 15:25.

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