Guest User

Untitled

a guest
Aug 1st, 2021
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. #if defined _INC_bleeding
  2. #endinput
  3. #endif
  4. #define _INC_bleeding
  5.  
  6.  
  7. static _inc_bleeding_blood[MAX_PLAYERS];
  8.  
  9.  
  10. #if defined _INC_y_hooks
  11. hook OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) {
  12. #else
  13. public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) {
  14. #endif
  15. new Float:h;
  16. GetPlayerHealth(playerid, h);
  17. if(h<60) SetTimerEx("_bleedingcheck", 2500, false, "i", playerid);
  18.  
  19. #if !defined _INC_y_hooks
  20. #if defined BLEEDING_OnPlayerTakeDamage
  21. return BLEEDING_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart);
  22. #else
  23. return 1;
  24. #endif
  25. #endif
  26. }
  27.  
  28.  
  29. #if !defined _INC_y_hooks
  30. #if defined _ALS_OnPlayerTakeDamage
  31. #undef OnPlayerTakeDamage
  32. #else
  33. #define _ALS_OnPlayerTakeDamage
  34. #endif
  35. #define OnPlayerTakeDamage BLEEDING_OnPlayerTakeDamage
  36. #if defined BLEEDING_OnPlayerTakeDamage
  37. forward BLEEDING_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart);
  38. #endif
  39. #endif
  40.  
  41.  
  42. forward _bleedingcheck(playerid);
  43. public _bleedingcheck(playerid) {
  44.  
  45. if(IsValidDynamicObject(_inc_bleeding_blood[playerid])) {
  46. DestroyDynamicObject(_inc_bleeding_blood[playerid]);
  47. return SetTimerEx("_bleedingcheck", 2500, false, "i", playerid);
  48. }
  49. new Float:health;
  50. GetPlayerHealth(playerid, health);
  51. if(health > 60) return 0;
  52. if(IsPlayerInWater(playerid) || Falling(playerid)) return SetTimerEx("_bleedingcheck", 2500, false, "i", playerid);
  53.  
  54. new Float:tX, Float:tY, Float:tZ;
  55. GetPlayerPos(playerid, tX,tY,tZ);
  56. _inc_bleeding_blood[playerid] = CreateDynamicObject(19836, tX,tY,tZ-0.95, 0,0,0);
  57. return SetTimerEx("_bleedingcheck", 2500, false, "i", playerid);
  58.  
  59. }
  60.  
  61. static stock IsPlayerInWater(playerid)
  62. {
  63. new Float:Z_C;
  64. GetPlayerPos(playerid,Z_C,Z_C,Z_C);
  65. if(Z_C < 0.7) switch(GetPlayerAnimationIndex(playerid)) { case 1543,1538,1539: return true; }
  66. if(GetPlayerDistanceFromPoint(playerid,-965,2438,42) <= 700 && Z_C < 45) return true;
  67. new Float:water_places[][] =
  68. {
  69. {25.0, 2313.0, -1417.0, 23.0},
  70. {15.0, 1280.0, -773.0, 1082.0},
  71. {15.0, 1279.0, -804.0, 86.0},
  72. {20.0, 1094.0, -674.0, 111.0},
  73. {26.0, 194.0, -1232.0, 76.0},
  74. {25.0, 2583.0, 2385.0, 15.0},
  75. {25.0, 225.0, -1187.0, 73.0},
  76. {50.0, 1973.0, -1198.0, 17.0}
  77. };
  78. for(new t=0; t < sizeof water_places; t++)
  79. if(GetPlayerDistanceFromPoint(playerid,water_places[t][1],water_places[t][2],water_places[t][3]) <= water_places[t][0]) return true;
  80. return false;
  81. }
  82.  
  83. static stock Falling(playerid)
  84. {
  85. new const index = GetPlayerAnimationIndex(playerid);
  86. if(index >= 958 && index <= 979 || index == 1130 || index == 1195 || index == 1132 || index >= 1195 && index <= 1198) return 1;
  87. return 0;
  88. }
  89.  
Advertisement
Add Comment
Please, Sign In to add comment