23.11.2010, 12:13
Quote:
Then do a variable check. Set true when crouching and set false when standing up from crouching.
|
ATM I got it working with timer (again )
In 500ms the player has time to stand up / crouch, and the GetPlayerSpecialAction returns the value I need.
So:
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
if( PRESSED(KEY_CROUCH) ) // CROUCH
{
CheckCrouch(playerid);
}
return 1;
}
Delay:CheckCrouch[500, i](playerid)
{
if( GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK )
{
//stuff
}
}