22.05.2016, 22:28
Hello, I've been scripting a Leg Breaking system similar to the one seen on LSRP,
and the animation seems to bug out and it freezes the player and whenever the animation stops playing it freezes the player, I've tried using a timer which stops the players animations and that doesnt work ethier,
here is my code,
and the animation seems to bug out and it freezes the player and whenever the animation stops playing it freezes the player, I've tried using a timer which stops the players animations and that doesnt work ethier,
here is my code,
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if (pLegBroken[playerid]) { if(newkeys & KEY_SPRINT || newkeys & KEY_JUMP) OnAnim{playerid} = true; ApplyAnimation(playerid,"PED","FALL_collapse",4.1,0,0,0,1,0); timerLegBreak[playerid] = SetTimerEx("LegBreakTimer", 2000, false, "d", playerid); }
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) { if(issuerid != INVALID_PLAYER_ID && weaponid >= 22 && weaponid <= 38 && (bodypart == 7 || bodypart == 8)) { if(pLegBroken[playerid] == false) { pLegBroken[playerid] = true; OnAnim{playerid} = true; FreezePlayer(playerid); ApplyAnimation(playerid,"PED","FALL_collapse",4.1,0,0,0,1,0); SCM(playerid, COLOR_LIGHTRED, "-> You've been hit in the leg, you're going to struggle with running and jumping."); timerLegBreak[playerid] = SetTimerEx("LegBreakTimer", 1000, false, "d", playerid); } }
Код:
forward LegBreakTimer(playerid); public LegBreakTimer(playerid) { StopPlayerAnims(playerid); }