Redundant test.
#1

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.
Reply
#2

Essentially means that you're doing
pawn Код:
if(2 == 2)
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)