20.03.2018, 20:24
(
Последний раз редактировалось Maxandmov; 20.03.2018 в 20:24.
Причина: Forgot some things
)
Hi there, fellas!
I've been working on something lately...
...Yeah, seems like SAMP won't just let me go, I guess...
Anyways, back to the topic.
I'm doing this system in OnPlayerUpdate since I need to detect any movement (for running especially) and not just holding a key.
Here's some portion of the code in use:
And here's some issues and precautions I'd love to consider:
1. I need to make sure it doesn't apply animation when I'm mid air. Am I right to assume ColAndreas will do the trick?
2. Tap sprinting and alike features don't work properly. This includes: Fighting while running or walking, sprinting, jumping (if not fixable as I desire via ColAndreas right at the moment of the jump, if I may). Is there some kind of a timer I can apply properly here to deal with these tap requirements without breaking the animation system?
Thanks for any assistance you can provide!
I've been working on something lately...
...Yeah, seems like SAMP won't just let me go, I guess...
Anyways, back to the topic.
I'm doing this system in OnPlayerUpdate since I need to detect any movement (for running especially) and not just holding a key.
Here's some portion of the code in use:
Код:
new keys, ud, lr; GetPlayerKeys(playerid, keys, ud, lr); //First, walking system if ((keys & KEY_WALK) && (ud & KEY_UP || ud & KEY_DOWN || lr & KEY_LEFT || lr & KEY_RIGHT) && !(keys & KEY_JUMP) && !(keys & KEY_SPRINT) && !(keys & KEY_AIM) && (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)) { if(runtime[playerid] != 0) { KillTimer(runtime[playerid]); } //I reset the timer for running so I don't have running animation applied. walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid); //And set walktime timer } //Then, running system. if((ud & KEY_UP || ud & KEY_DOWN || lr & KEY_LEFT || lr & KEY_RIGHT) && !(keys & KEY_SPRINT) && !(keys & KEY_WALK) && !(keys & KEY_AIM) && !(keys & KEY_JUMP) && (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)) { if(walktime[playerid] != 0) { KillTimer(walktime[playerid]); } //Just like walking, but vice versa. runtime[playerid] = SetTimerEx("RunAnim", 200,0,"d",playerid); }
1. I need to make sure it doesn't apply animation when I'm mid air. Am I right to assume ColAndreas will do the trick?
2. Tap sprinting and alike features don't work properly. This includes: Fighting while running or walking, sprinting, jumping (if not fixable as I desire via ColAndreas right at the moment of the jump, if I may). Is there some kind of a timer I can apply properly here to deal with these tap requirements without breaking the animation system?
Thanks for any assistance you can provide!