SA-MP Forums Archive
Dialog and OnPlayerKeyStateChange - bug - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dialog and OnPlayerKeyStateChange - bug (/showthread.php?tid=218451)



Dialog and OnPlayerKeyStateChange - bug - chormi - 30.01.2011

Hi

I have a problem with OnPlayerKeyStateChange callback.

Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	printf("[OnPlayerKeyStateChange]: newkeys: %d oldkeys: %d",newkeys,oldkeys);
           return 1;
}
So, when the show player dialog and player press numpad 4 or numpad 6 key, callback return strange values.

Code:
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 16 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 16
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 128 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 128
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 128 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 128
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 128 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 128
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 128 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 128
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 128 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 128
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 32 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 32
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 128 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 128
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
[OnPlayerKeyStateChange]: newkeys: 32 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 32
[OnPlayerKeyStateChange]: newkeys: 128 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 128
[OnPlayerKeyStateChange]: newkeys: 8 oldkeys: 0
[OnPlayerKeyStateChange]: newkeys: 0 oldkeys: 8
This situation is only i show dialog for player.
Sory, for my bad english


Re: Dialog and OnPlayerKeyStateChange - bug - PeteShag - 30.01.2011

What is wrong?

OnPlayerKeyStateChange logs every key and returns invalid/unused as 0


Re: Dialog and OnPlayerKeyStateChange - bug - chormi - 30.01.2011

Quote:
Originally Posted by PeteShag
View Post
What is wrong?

OnPlayerKeyStateChange logs every key and returns invalid/unused as 0
Look:

1. I show Player Dialog
2. Player press numpad 4
3. In console print: 8
4. Player press numpad 4 again
5. In console print: 8 or 128 or 32 or 0 etc.

When must show: 8192

2. Player press numpad 6
3. In console print: 128
4. Player press numpad 6 again
5. In console print: 8 or 128 or 32 or 0 etc.

When must show: 16384


Re: Dialog and OnPlayerKeyStateChange - bug - Retardedwolf - 30.01.2011

When a player is shown a dialog, I don't think keystrokes will get sent to oPKSC


Re: Dialog and OnPlayerKeyStateChange - bug - chormi - 30.01.2011

Quote:
Originally Posted by Retardedwolf
View Post
When a player is shown a dialog, I don't think keystrokes will get sent to oPKSC
and should be, it prevents me to write a modern banking system. So far I used textdraws and the menu, but it looks ugly


Re: Dialog and OnPlayerKeyStateChange - bug - chormi - 30.01.2011

To dev team: Please fix this bug.


Re: Dialog and OnPlayerKeyStateChange - bug - vengeance89 - 17.06.2011

I think I know a solution for this, I think you forgot something its showin' below:

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    print("[OnPlayerKeyStateChange]: newkeys: %d oldkeys: %d,newkeys,oldkeys);
        return 1;
}
Just copy that PAWN code.

and it is not like this

pawn Code:
printf("[OnPlayerKeyStateChange]: newkeys: %d oldkeys: %d",newkeys,oldkeys);



Re: Dialog and OnPlayerKeyStateChange - bug - alpha500delta - 17.06.2011

Quote:
Originally Posted by vengeance89
View Post
I think I know a solution for this, I think you forgot something its showin' below:

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    print("[OnPlayerKeyStateChange]: newkeys: %d oldkeys: %d,newkeys,oldkeys);
        return 1;
}
Just copy that PAWN code.
Fail post, you can't gotta format stuff for print... also you forgot a "
And I don't think that user has this problem anymore (wtf confusing)