warning 211: possibly unintended assignment
#2

pawn Код:
if (pStats[playerid][vip] == 1)
    {
        SetPlayerColor(playerid, 0x99330000);
        return 1;
    }
    if (pStats[playerid][vip] == 2)
    {
        SetPlayerColor(playerid, 0x99999900);
        return 1;
    }
    if (pStats[playerid][vip] == 3)
    {
        SetPlayerColor(playerid, 0xFFCC0000);
        return 1;
    }
    if (pStats[playerid][vip] == 4)
    {
        SetPlayerColor(playerid, 0x00FFFF00);
        return 1;
    }
    if (pStats[playerid][admin] >= 1)
    {
        SetPlayerColor(playerid, 0xFF00FF00);
        return 1;
    }
    else
    {
        SetPlayerColor(playerid, 0xC4C4C400);
    }
pawn Код:
CMD:hc(playerid, params[])
{
    if (pStats[playerid][gmute] == 1)
    {
        new sendername[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "{00FFFF}» HELP |{FFFFFF} %s: %s", sendername, params);
        SendClientMessageToAll(COLOR_WHITE, string);
    }
    else SendClientMessage(playerid, -4, "You are muted from the help chat!");
    return 1;
}
pawn Код:
CMD:g(playerid, params[])
{
    if (pStats[playerid][gmute] == 1)
    {
        new sendername[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "{FF0000}» GLOBAL |{FFFFFF} %s: %s", sendername, params);
        SendClientMessageToAll(COLOR_WHITE, string);
    }
    else SendClientMessage(playerid, -4, "You are muted from the global chat!");
    return 1;
}

The assignment operator (=) was found in an if-statement, instead of the equality operator (==). If the assignment is intended, the expression must be wrapped in parentheses. Example:

pawn Код:
if(a = 2) // warning
if(a == 2) // no warning
if((a = 2)) // no warning; the value 2 will be assigned to variable a and the expression will always return true.
Reply


Messages In This Thread
warning 211: possibly unintended assignment - by [WA]iRonan - 29.12.2013, 13:19
Re: warning 211: possibly unintended assignment - by Stereotype - 29.12.2013, 13:23
Re: warning 211: possibly unintended assignment - by [WA]iRonan - 29.12.2013, 13:26

Forum Jump:


Users browsing this thread: 1 Guest(s)