SA-MP Forums Archive
What the... - 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: What the... (/showthread.php?tid=606373)



What the... - Micko123 - 03.05.2016

Код:
warning 206: redundant test: constant expression is non-zero
These are the lines
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(PRESSING(newkeys, KEY_YES)) //line of warning
	{
	    if(IsPlayerInAnyVehicle(playerid))
	    {
	        SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.0, 0.0, 0.2);
	        return 1;
		}
	}
	return 1;
}



Re: What the... - F1N4L - 03.05.2016

You are using a macro done in the wiki.

Use:

Код:
if(newkeys == KEY_YES))
{
   if(IsPlayerInAnyVehicle(playerid))
   {
      SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.0, 0.0, 0.2);
      return 1;
      }
}



Re: What the... - Micko123 - 03.05.2016

Thank you. It worked


Re: What the... - TheHonnor - 03.05.2016

I recommend you to use:

if(newkeys & KEY_YES)

Because you'll can to press Y key when you are already pressing another button..