Tag Mismatch
#1

Hey Guys!

I have a dcmd command which shows/hides a textdraw called Infobox, and the compiler writes 4x Tag Mismatches.

The warnings:
Код:
C:\Documents and Settings\Bence\Asztal\sa.mp\gamemodes\Fun.pwn(976) : warning 213: tag mismatch
C:\Documents and Settings\Bence\Asztal\sa.mp\gamemodes\Fun.pwn(976) : warning 213: tag mismatch
C:\Documents and Settings\Bence\Asztal\sa.mp\gamemodes\Fun.pwn(977) : warning 213: tag mismatch
C:\Documents and Settings\Bence\Asztal\sa.mp\gamemodes\Fun.pwn(983) : warning 213: tag mismatch
And here is the code:
pawn Код:
dcmd_infodoboz(playerid, params[])
{
    new
        swtch[10];
    if(sscanf(params, "s", swtch)) return SendClientMessage(playerid, colorFAIL, "Hasznбlat: /infodoboz <be/ki>");
    if(!strcmp(swtch, "be", 1) || !strcmp(swtch, "ki", 1)) return SendClientMessage(playerid, colorFAIL, "Hasznбlat: /infodoboz <be/ki>");//976
    if(!strcmp(swtch, "be", 1))//977
    {
        TextDrawShowForPlayer(playerid, Infobox[0]);
        TextDrawShowForPlayer(playerid, Infobox[1]);
        SendClientMessage(playerid, colorSUCCESS, "Infodoboz bekapcsolva!");
    }
    if(!strcmp(swtch, "ki", 1))//983
    {
        TextDrawHideForPlayer(playerid, Infobox[0]);
        TextDrawHideForPlayer(playerid, Infobox[1]);
        SendClientMessage(playerid, colorSUCCESS, "Infodoboz kikapcsolva!");
    }
    return 1;
}
Please help to make it work

Thanks
Nonameman
Reply
#2

pawn Код:
dcmd_infodoboz(playerid, params[])
{
    new swtch[10];
    if(sscanf(params, "s", swtch)) return SendClientMessage(playerid, colorFAIL, "Hasznбlat: /infodoboz <be/ki>");
    if(strcmp(swtch, "be", true) || strcmp(swtch, "ki", true)) return SendClientMessage(playerid, colorFAIL, "Hasznбlat: /infodoboz <be/ki>");
    if(!strcmp(swtch, "be", true))
    {
        TextDrawShowForPlayer(playerid, Infobox[0]);
        TextDrawShowForPlayer(playerid, Infobox[1]);
        SendClientMessage(playerid, colorSUCCESS, "Infodoboz bekapcsolva!");
    }
    else if(!strcmp(swtch, "ki", true))
    {
        TextDrawHideForPlayer(playerid, Infobox[0]);
        TextDrawHideForPlayer(playerid, Infobox[1]);
        SendClientMessage(playerid, colorSUCCESS, "Infodoboz kikapcsolva!");
    }
    return 1;
}
Reply
#3

Thanks.
I thought 0/1 do the same thing as false/true.
Reply
#4

Quote:
Originally Posted by Nonameman
Посмотреть сообщение
Thanks.
I thought 0/1 do the same thing as false/true.
You're right that they're the same values... however the difference is "true" and "false" are tagged variables with the tag "bool:". The function strcmp expects a bool: tag, it will work the same if you use 1/0 but will chuck you warnings as you just found out .
Reply
#5

Quote:
Originally Posted by Simon
Посмотреть сообщение
You're right that they're the same values... however the difference is "true" and "false" are tagged variables with the tag "bool:". The function strcmp expects a bool: tag, it will work the same if you use 1/0 but will chuck you warnings as you just found out .
Haha thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)