OnPlayerKeyChange
#1

Hello. I have an error with OnPlayerKeyCahgen..

When i press KEY_CTRL_BACK its print z-, up, left
WHen i press KEY_NO its print z+, up, left
And when press KEY_UP, KEY_DOWN, KEY_RIGHT, KEY_LEFT its not print anything.. Why? Someone please help me... Thanks!

Код:
	if (PRESSED( KEY_CTRL_BACK ))
	{
        printf("z+");
	}
	if (PRESSED( KEY_NO ))
	{
        printf("z-");
	}
 	if (PRESSED( KEY_UP ))
	{
		printf("up");
	if ((newkeys & KEY_DOWN) && !(oldkeys & KEY_DOWN))
	{
        printf("down");
	}
 	if ((newkeys & KEY_LEFT) && !(oldkeys & KEY_LEFT))
	{
        printf("left");
	}
 	if ((newkeys & KEY_RIGHT) && !(oldkeys & KEY_RIGHT))
	{
		printf("right");
	}
Reply
#2

UP DOWN LEFT and RIGHT can only be detected with GetPlayerKeys, not via OnPlayerKeyStateChange

look here for an example:
https://sampwiki.blast.hk/wiki/GetPlayerKeys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)