OnPlayerKeyStateChange NOT working!
#1

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(newkeys & KEY_LEFT)
	{
		print("Player has pressed KEY_LEFT");
	}
	if(newkeys & KEY_RIGHT)
	{
		print("Player has pressed KEY_RIGHT");
	}
	if(newkeys & KEY_SPRINT)
	{
		print("Player has pressed KEY_SPRINT");
	}
	if(newkeys & KEY_SPRINT)
	{
		print("Player has pressed KEY_SPRINT");
	}
	if(newkeys & KEY_SECONDARY_ATTACK)
	{
		print("Player has pressed KEY_SECONDARY_ATTACK");
	}
	return 1;
}
Problem:

I press key left - nothing hapends.
I press key right - nothing hapends.
I press key shift - nothing hapends.
I press key enter - it prints "Player has pressed KEY_SECONDARY_ATTACK".
Reply
#2

Use wiki, ****** posted a big explaination there.
Reply
#3

Left, right, up and down are not processed by OnPlayerKeyStateChange, and KEY_SPRINT is space, not shift
Reply
#4

Quote:
Originally Posted by dice7
Left, right, up and down are not processed by OnPlayerKeyStateChange, and KEY_SPRINT is space, not shift
Thanks you, but how can you check if a players pressed keys like → ?

Quote:
Originally Posted by MenaceX^
Use wiki, ****** posted a big explaination there.
Can you give me a link? i cannot find it there.
Reply
#5

You can't, only keys like in single player aka these
https://sampwiki.blast.hk/wiki/GetPlayerKeys#Key_List
Reply
#6

Quote:
Originally Posted by [NL
WackoX ]
Quote:
Originally Posted by dice7
Left, right, up and down are not processed by OnPlayerKeyStateChange, and KEY_SPRINT is space, not shift
Thanks you, but how can you check if a players pressed keys like → ?

Quote:
Originally Posted by MenaceX^
Use wiki, ****** posted a big explaination there.
Can you give me a link? i cannot find it there.
Search better, it's like a poor excuse because you just write the address, a slash and then the public name.
Quote:
Originally Posted by dice7
You can't, only keys like in single player aka these
https://sampwiki.blast.hk/wiki/GetPlayerKeys#Key_List
Yes he can. I saw it somewhere there.
Reply
#7

Quote:
Originally Posted by MenaceX^
Quote:
Originally Posted by [NL
WackoX ]
Quote:
Originally Posted by dice7
Left, right, up and down are not processed by OnPlayerKeyStateChange, and KEY_SPRINT is space, not shift
Thanks you, but how can you check if a players pressed keys like → ?

Quote:
Originally Posted by MenaceX^
Use wiki, ****** posted a big explaination there.
Can you give me a link? i cannot find it there.
Search better, it's like a poor excuse because you just write the address, a slash and then the public name.
Quote:
Originally Posted by dice7
You can't, only keys like in single player aka these
https://sampwiki.blast.hk/wiki/GetPlayerKeys#Key_List
Yes he can. I saw it somewhere there.
Okay now i use ShowPlayerDialog instead of keys, it better i think.
But how can i delete the Dialog without pressing any key?
Reply
#8

Why you gave up so fast? You could've done it still using OnPlayerKeyStateChange.
Reply
#9

Quote:
Originally Posted by Y_Leѕѕ
Show one that doesn't exist (such as -1).
Do you mean like this?

ShowPlayerDialog(playerid, -1, DIALOG_STYLE_MSGBOX, " ", " ", " "," ");

Quote:
Originally Posted by MenaceX^
Why you gave up so fast? You could've done it still using OnPlayerKeyStateChange.
Because i just want to use key > and < but that isn't posible as some said.
Reply
#10

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)