SA-MP Forums Archive
Getting mistmatch warnings on an IF statement. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Getting mistmatch warnings on an IF statement. (/showthread.php?tid=663760)



Getting mistmatch warnings on an IF statement. - XpoZzA - 10.02.2019

I have no idea why, but I am getting some mismatch warnings on these two lines in my code:

PHP код:
CMD:admins(playeridparams[])
{
    new 
onlinestring[128];
       if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    foreach(
Playeri)
    {
        if(
PlayerInfo[i][pHelper])
        {
            
online ++;
        }
    }
    
format(stringsizeof(string), "|_____Bone County RolePlay Administrator Team_____|");
    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
    foreach(
Playeri)
    {
        if(!
aDuty[i] == && PlayerInfo[i][pAdmin]) //Mismatch Warning 1
        
{
            
format(stringsizeof(string), " %s %s  status: Roleplaying "RPALN(i), RPN(i));
            
SendClientMessage(playeridCOLOR_DARKREDstring);
        }
        if(!
aDuty[i] == && PlayerInfo[i][pAdmin]) //Mismatch Warning 2
        
{
            
format(stringsizeof(string), " %s %s  status: On duty "RPALN(i), RPN(i));
            
SendClientMessage(playeridCOLOR_DARKREDstring);
        }
    }
    return 
1;

Would appreciate the help, thanks!


Re: Getting mistmatch warnings on an IF statement. - d3Pedro - 10.02.2019

pawn Код:
if(!aDuty[i] == 1
This cause you tag mismatch, read https://sampwiki.blast.hk/wiki/Control_Structures


Re: Getting mistmatch warnings on an IF statement. - Calisthenics - 10.02.2019

Remove ! from aDuty. You cannot check if it is 0 using ! and if it is 1 or 2 at the same time. It expects none but finds bool tag.


Re: Getting mistmatch warnings on an IF statement. - XpoZzA - 10.02.2019

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
Remove ! from aDuty. You cannot check if it is 0 using ! and if it is 1 or 2 at the same time. It expects none but finds bool tag.
That fixed it, thank you very much.
I feel so dumb not seeing that problem now, lol.