16.07.2015, 06:43
So I've made this little code and I cut out a bit of it to save some space to make it easier to read;
Now I've got this under OnPlayerKeyStateChange;
Why does this apply the animation at all times? Even when the walking animation isn't being played?
Код:
public OnPlayerUpdate(playerid) { new Keys,ud,lr; GetPlayerKeys(playerid,Keys,ud,lr); if((ud == KEY_UP) && (HoldingForWalkstyle[playerid] == 1) && (UsingWalkstyle[playerid] == 0)) { UsingWalkstyle[playerid] = 1; switch(pData[playerid][pWalkStyle]) { case 1: ApplyAnimation............ till case 15 } } ... so it goes for every key (up/down/left/right) return 1; }
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(HOLDING(KEY_WALK)) { if(!IsPlayerInAnyVehicle(playerid)) { HoldingForWalkstyle[playerid] = 1; } } if(PRESSED(KEY_WALK)) { if(UsingWalkstyle[playerid] == 1 && !IsPlayerInAnyVehicle(playerid)) { ApplyAnimationEx(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0); } } return 1; }