Button help
#1

Hey all. I would like to create log, that show which keys player pressing. I know one way how to create it:
Код:
if(newkeys == KEY_WALK)
{
//LOG CODE
}
But maybe it is other way to create it easier, because in my way I should create for every button code separately + if player pressing 2 keys, code will show only first pressed key. I need that code will show all pressed keys ( if press 2 in same tame, show 2 ). Any other solutions?
Reply
#2

You can log them when OnPlayerKeyStateChange is being called without the need to check for certain keys or combinations. However it will log way too frequently and depends on the method you will use for logging, there might be a noticeable lag.
Reply
#3

Just print the newkeys value?

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    
printf("newkeys: %d"newkeys);
    return 
1;

Reply
#4

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
Just print the newkeys value?

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    
printf("newkeys: %d"newkeys);
    return 
1;

Ye, this is good way. I tried it, and when I press space i got:

Код:
[21:24:31] newkeys: 8
[21:24:31] newkeys: 0
First line show space ID - 8, but why also that second line appeared? When I press other keys, that line with 0 also appears. How to do, that printf will show only first line?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)