SA-MP Forums Archive
redundant test: constant expression is non-zero - 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: redundant test: constant expression is non-zero (/showthread.php?tid=428608)



redundant test: constant expression is non-zero - TheSka - 06.04.2013

I get this final error

Код:
Warning 206 : redundant test: constant expression is non-zero
Whole code relating to the warning.

pawn Код:
{
                new vehicleid = GetPlayerVehicleID(playerid),
                playingid = v_VehicleInfo[vehicleid][RadioPlaying];
               
                if(TEXTDRAWSET == 2)
                {
                    format(string,sizeof(string),"Listening to: ~n~~w~%s",r_RadioInfo[playingid][r_Name]);
                    TextDrawSetString(v_VehicleInfo[vehicleid][r_Draw],string);
                }
                else
                {
                    TextDrawSetString(v_VehicleInfo[vehicleid][r_Draw],r_RadioInfo[playingid][r_Name]);
                }
                TextDrawShowForPlayer(playerid,v_VehicleInfo[vehicleid][r_Draw]);
                SetPVarInt(playerid,"ID_HideRadioTextdraw",SetTimerEx("HideRadioTextdraw",TEXTDRAW_DISAPPEAR_TIME,false,"ii",playerid,vehicleid));
                PlayAudioStreamForPlayer(playerid,r_RadioInfo[playingid][r_Link]);
                SetPVarInt(playerid,"ID_OldVehicle",vehicleid);
            }
Specific code relating to the warning

pawn Код:
if(TEXTDRAWSET == 2)
Plus, I have defined the TEXTDRAWSET as USE_TEXTDRAW_SET as

pawn Код:
#define TEXTDRAWSET USE_TEXTDRAW_SET
I need help in this, will be grateful if anyone can help me out!


Re: redundant test: constant expression is non-zero - iJumbo - 06.04.2013

where USE_TEXTDRAW_SET come from?


Re: redundant test: constant expression is non-zero - Stylock - 06.04.2013

That means that the condition is basically useless. You're doing something like:
Код:
if (2 == 2)
{
    ...
}
That will always be true. You should do that condition at compile time using #if etc.


Re: redundant test: constant expression is non-zero - TheSka - 06.04.2013

Ok, either I can use #if, or..?

@1st reply, See 'the whole code relating to the warning' in the thread..


Re: redundant test: constant expression is non-zero - Basssiiie - 06.04.2013

Quote:
Originally Posted by TheSka
Посмотреть сообщение
Ok, either I can use #if, or..?
Yes, you can use #if and #else. That should work fine.