SA-MP Forums Archive
Help me warning 206 - 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: Help me warning 206 (/showthread.php?tid=584813)



Help me warning 206 - thaihan - 08.08.2015

My error
PHP код:
C:\Documents and Settings\Admin\Desktop\VietOl 1.2\gamemodes\vnit.pwn(21533) : warning 206redundant testconstant expression is non-zero 
My code:
PHP код:
if ((oldkeys KEY_FIRE) && (newkeys KEY_CROUCH))
    {
        new 
weapon GetPlayerWeapon(playerid);
        if(
weapon == 24,25,27,22)
        {
            
ApplyAnimation(playerid,"GYMNASIUM","gym_tread_falloff",1.0,0,0,0,0,0);
            
//GameTextForPlayer(playerid, "~r~Stop c-bug !", 5000, 1);
        
}
    } 
help my


Re: Help me warning 206 - Sellize - 08.08.2015

PHP код:
if ((oldkeys == KEY_FIRE) && (newkeys == KEY_CROUCH)) 
    { 
        new 
weapon GetPlayerWeapon(playerid); 
        if(
weapon == 24,25,27,22
        { 
            
ApplyAnimation(playerid,"GYMNASIUM","gym_tread_falloff",1.0,0,0,0,0,0); 
            
//GameTextForPlayer(playerid, "~r~Stop c-bug !", 5000, 1); 
        

    } 



Re: Help me warning 206 - jamesbond007 - 08.08.2015

Quote:
Originally Posted by Sellize
Посмотреть сообщение
PHP код:
if ((oldkeys == KEY_FIRE) && (newkeys == KEY_CROUCH)) 
    { 
        new 
weapon GetPlayerWeapon(playerid); 
        if(
weapon == 24,25,27,22
        { 
            
ApplyAnimation(playerid,"GYMNASIUM","gym_tread_falloff",1.0,0,0,0,0,0); 
            
//GameTextForPlayer(playerid, "~r~Stop c-bug !", 5000, 1); 
        

    } 
are you kidding me? how u have so much rep .?

the problem is with if(weapon == 24,25,27,22)

u have to do if(weapon == 24 || weapon == 25 || ... ) etc


Re: Help me warning 206 - Syzygy1 - 08.08.2015

Use switch.

pawn Код:
switch(weapon)
{
    case 24, 25, 27, 22:
    {
        ApplyAnimation(playerid,"GYMNASIUM","gym_tread_falloff",1.0,0,0,0,0,0);
        //GameTextForPlayer(playerid, "~r~Stop c-bug !", 5000, 1);
    }
}



Re: Help me warning 206 - thaihan - 09.08.2015

thanks all.