Redundant test. - 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. (
/showthread.php?tid=438895)
Redundant test. -
whando - 22.05.2013
Hello, I got a problem, can't find it myself as I just started scripting and still
learning. I got this warning when I compile my GM, I know it's not 'dangerous' but I want to remove it so I can learn from it...
warning 206: redundant test: constant expression is non-zero
Код:
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new vehicleid = GetPlayerVehicleID(playerid),
playingid = v_VehicleInfo[vehicleid][RadioPlaying];
if(USE_TEXTDRAW_SET == 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]);
}
if(USE_TEXTDRAW_SET == 2) Is the line of the error.
Re: Redundant test. -
Vince - 22.05.2013
Essentially means that you're doing
which is pointless. Use the #if directive instead.
Though I believe the very same question was answered with the very same answer a few days or weeks ago.