Quote:
Originally Posted by d1git
I just updated the code, it should work now - typo basically.
PHP код:
new sprint[MAX_PLAYERS];
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_SPRINT))
{
sprint[playerid] = 1; // Player pressed the sprint key
}
if(RELEASED(KEY_SPRINT))
{
sprint[playerid] = 0; // Player letgo of the sprint key
}
return 1;
}
|
So it's currently detecting if the player press on SPACE etc but if he's just standing? how can i make sure it detects when he's running? i've an idea, maybe if he's pressing on the KEY_SPRINT + W or S or A or D. how can i do it?