SA-MP Forums Archive
If error - 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: If error (/showthread.php?tid=555438)



If error - n00el - 07.01.2015

Код:
if(GetPlayerSkin(playerid) != 71, 282, 288, 283)
Why its wrong?
warning 206: redundant test: constant expression is non-zero


Re: If error - PowerPC603 - 07.01.2015

"If" can only be used to check one value, not 4 different ones at the same time.
Try this:
pawn Код:
if((GetPlayerSkin(playerid) != 71) && (GetPlayerSkin(playerid) != 282) && (GetPlayerSkin(playerid) != 288) && (GetPlayerSkin(playerid) !=  283))
Or use a switch case:
pawn Код:
switch(GetPlayerSkin(playerid))
{
    case 71, 282, 288, 283:
    {
        // The skin is either 71, 282, 288 or 283
    }
    default:
    {
        // The skin is anything other than 71, 282, 288 or 283
    }
}



Respuesta: If error - JuanStone - 07.01.2015

else:

pawn Код:
if(GetPlayerSkin(playerid) != 71 && GetPlayerSkin(playerid) != 282 && GetPlayerSkin(playerid) != 283 && GetPlayerSkin(playerid) != 288)
    {
        // something
    }