12.02.2015, 19:29
Quote:
Amazing tutorial you got here.
Just a quick question, lets say I want the player who got shot in the leg unable to run, how do I stop them from sprinting? |
For the leg function, start off by creating a variable called etc. "Injured[MAX_PLAYERS]".
Then under OnPlayerTakeDamage, check if the bodypart hit was one of his legs, if so, set the variable to 1.
pawn Code:
Injured[playerid] = 1; // Sets the players variable to 1.
pawn Code:
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
pawn Code:
if(HOLDING(KEY_UP) || HOLDING(KEY_LEFT) || HOLDING(KEY_RIGHT) || HOLDING(KEY_DOWN) && HOLDING(KEY_SPRINT))
pawn Code:
if(Injured[playerid] = 1 && !IsPlayerInAnyVehicle(playerid)) ApplyAnimation(...);
pawn Code:
if(RELEASED(KEY_SPRINT)) ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
You could also use "ClearAnimations(playerid);", but that would ruin his running speed.