SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 21/10/2009, 03:03 PM   #1
Andom
Huge Clucker
 
Join Date: Mar 2009
Posts: 321
Reputation: 0
Default OnPlayerKeyStateChange NOT working!

Code:
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".
Andom is offline  
Old 21/10/2009, 03:05 PM   #2
MenaceX^
High-roller
 
Join Date: Aug 2008
Posts: 3,262
Reputation: 13
Default Re: OnPlayerKeyStateChange NOT working!

Use wiki, ****** posted a big explaination there.
MenaceX^ is offline  
Old 21/10/2009, 03:07 PM   #3
dice7
High-roller
 
Join Date: Apr 2009
Location: Slovenia
Posts: 2,200
Reputation: 22
Default Re: OnPlayerKeyStateChange NOT working!

Left, right, up and down are not processed by OnPlayerKeyStateChange, and KEY_SPRINT is space, not shift
dice7 is offline  
Old 21/10/2009, 03:09 PM   #4
Andom
Huge Clucker
 
Join Date: Mar 2009
Posts: 321
Reputation: 0
Default Re: OnPlayerKeyStateChange NOT working!

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.
Andom is offline  
Old 21/10/2009, 03:10 PM   #5
dice7
High-roller
 
Join Date: Apr 2009
Location: Slovenia
Posts: 2,200
Reputation: 22
Default Re: OnPlayerKeyStateChange NOT working!

You can't, only keys like in single player aka these
http://wiki.sa-mp.com/wiki/GetPlayerKeys#Key_List
dice7 is offline  
Old 21/10/2009, 03:26 PM   #6
MenaceX^
High-roller
 
Join Date: Aug 2008
Posts: 3,262
Reputation: 13
Default Re: OnPlayerKeyStateChange NOT working!

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
http://wiki.sa-mp.com/wiki/GetPlayerKeys#Key_List
Yes he can. I saw it somewhere there.
MenaceX^ is offline  
Old 21/10/2009, 03:39 PM   #7
Andom
Huge Clucker
 
Join Date: Mar 2009
Posts: 321
Reputation: 0
Default Re: OnPlayerKeyStateChange NOT working!

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
http://wiki.sa-mp.com/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?
Andom is offline  
Old 21/10/2009, 04:17 PM   #8
MenaceX^
High-roller
 
Join Date: Aug 2008
Posts: 3,262
Reputation: 13
Default Re: OnPlayerKeyStateChange NOT working!

Why you gave up so fast? You could've done it still using OnPlayerKeyStateChange.
MenaceX^ is offline  
Old 21/10/2009, 05:48 PM   #9
Andom
Huge Clucker
 
Join Date: Mar 2009
Posts: 321
Reputation: 0
Default Re: OnPlayerKeyStateChange NOT working!

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.
Andom is offline  
Old 23/10/2009, 12:22 PM   #10
Andom
Huge Clucker
 
Join Date: Mar 2009
Posts: 321
Reputation: 0
Default Re: OnPlayerKeyStateChange NOT working!

bump
Andom is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[HELP]OnPlayerKeyStateChange none of them are working Lilcuete Help Archive 11 07/05/2010 02:54 AM
OnPlayerKeyStateChange Zoutdaxv Help Archive 9 12/12/2009 02:10 AM
OnPlayerKeyStateChange.Help pierhs Help Archive 13 28/11/2009 09:44 AM
OnPlayerKeyStateChange Abernethy Help Archive 2 30/08/2009 09:35 AM
OnPlayerKeyStateChange [top_Shoter] Help Archive 17 19/07/2009 09:57 AM


All times are GMT. The time now is 03:43 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.