Advertisement
Guest User

louis my baby

a guest
Apr 26th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. // - Louis, add brokenleg[playerid] = 0; under OnPlayerDeath and under the command when someone gets revived, so it removes their broken leg so they aren't stuck with it.
  2.  
  3. new brokenleg[MAX_PLAYERS];
  4. new legtimer[MAX_PLAYERS];
  5.  
  6. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  7. {
  8. if(brokenleg[playerid] == 1)
  9. {
  10. if(newkeys & KEY_JUMP && !(oldkeys & KEY_JUMP) )
  11. {
  12. ApplyAnimation(playerid, "GYMNASIUM", "gym_jog_falloff",4.1,0,1,1,0,0);
  13. }
  14. if(newkeys & KEY_SPRINT && !(oldkeys & KEY_SPRINT) )
  15. {
  16. ApplyAnimation(playerid, "PED", "FALL_collapse", 4.1,0,1,1,0,0);
  17. }
  18. }
  19.  
  20. public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
  21. {
  22. if(issuerid != INVALID_PLAYER_ID)
  23. {
  24. switch(bodypart)
  25. {
  26. case 7, 8:
  27. {
  28. BreakLeg(playerid);
  29. }
  30. }
  31. }
  32.  
  33. stock BreakLeg(playerid)
  34. {
  35. SendClientMessage(playerid, COLOR_LIGHTRED, "You have been shot in the leg, you wont be able to run or jump");
  36. KillTimer(legtimer[playerid]);
  37. brokenleg[playerid] = 1;
  38. legtimer[playerid] = SetTimerEx( "BrokenLegFix", 90000, false, "i", playerid );
  39. return 1;
  40. }
  41.  
  42. stock FixLeg(playerid)
  43. {
  44. KillTimer(legtimer[playerid]);
  45. brokenleg[playerid] = 0;
  46. return 1;
  47. }
  48.  
  49. forward BrokenLegFix(playerid);
  50. public BrokenLegFix(playerid)
  51. {
  52. FixLeg(playerid);
  53. return 1;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement