Posts: 1,767
Threads: 124
Joined: Mar 2010
Is there any way to check, is key has been released by user? i.e
if(Keys & KEY_FIRE)
{
}
if(RELEASED(KEY_FIRE))
{
}
or something like that? I'm using GetPlayerKeys in timer ex.
Posts: 1,767
Threads: 124
Joined: Mar 2010
Quote:
Originally Posted by doreto
|
Did you read my post or thread title?
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
That's exacly what you asked? Please elaborate on what you're trying to do.
Posts: 1,767
Threads: 124
Joined: Mar 2010
Quote:
Originally Posted by Vince
That's exacly what you asked? Please elaborate on what you're trying to do.
|
Can I check in my timer, with GetPlayerKeys function.. when I released each key? for example:
pawn Код:
if(holding/pressed(KEY_FIRE))
{
// do something
}
else if(released(KEY_FIRE))
{
// do something
}
I thought it was enough info in first post to understand, my mistake, sorry. Anyway, as we know GetPlayerKeys we're checking like:
But we don't have oldkeys for GetPlayerKeys. That's why I'm stuck, or maybe I am an idiot and I don't know how to use GetPlayerKeys to check released key. If I am, then tell me, please.
Posts: 654
Threads: 20
Joined: Jul 2009
Reputation:
0
You're getting confused with GetPlayerKeys and OnPlayerKeyStateChange. GetPlayerKeys simply returns the current keys the player is pressing, whereas the OnPlayerKeyStateChange callback is called every time a player changes their key combination. It wouldn't make sense to include an oldkeys parameter in this function.
I don't know why you would favor GetPlayerKeys over OnPlayerKeyStateChange for this functionality. But nonetheless, you'd have to store their previous "oldkeys" attribute in variables which you can compare and retrieve when getting their new keys.
Posts: 1,767
Threads: 124
Joined: Mar 2010
Quote:
Originally Posted by Jay_
You're getting confused with GetPlayerKeys and OnPlayerKeyStateChange. GetPlayerKeys simply returns the current keys the player is pressing, whereas the OnPlayerKeyStateChange callback is called every time a player changes their key combination. It wouldn't make sense to include an oldkeys parameter in this function.
I don't know why you would favor GetPlayerKeys over OnPlayerKeyStateChange for this functionality. But nonetheless, you'd have to store their previous "oldkeys" attribute in variables which you can compare and retrieve when getting their new keys.
|
Thanks for the idea, however I wanted to make it in KeyStateChange callback but, wondering.. from time to time I need someone whose gonna enlight me.. anyway, thanks.