[BUG] bit logical product
#1

I have problem with the keys in the 0.3 (do not know whether the bug is in 0.2), you see the operator & does not work with positive numbers, example:

Код:
	GetPlayerKeys(playerid, Arrays[tmpInt][0], Arrays[tmpInt][1], Arrays[tmpInt][2]);

	if(Arrays[tmpInt][1] & KEY_UP)
	{
		print("UP");
		return 1;
	}

	if(Arrays[tmpInt][1] & KEY_DOWN)
	{
		print("DOWN");
		return 1;
	}

	if(Arrays[tmpInt][2] & KEY_LEFT)
	{
		print("LEFT");
		return 1;
	}

	if(Arrays[tmpInt][2] & KEY_RIGHT)
	{
		print("RIGHT");
		return 1;
	}
if I press UP key, console shows UP (good)
if I press DOWN key, console show UP too (bad)
if I press LEFT key, console show LEFT (good)
if I press RIGHT key, console show LEFT too (bad)

Код:
#define KEY_UP					(-128)
#define KEY_DOWN				(128)
#define KEY_LEFT				(-128)
#define KEY_RIGHT				(128)
if I change & to ==, it works good
Reply
#2

but I've wanted with &, cause with ==, not works if player pressed another keys too

and bugs should be fixed
Reply
#3

Try using &&
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)