Guest User

Untitled

a guest
Aug 1st, 2021
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. // ========================================================================== //
  2. /*
  3. KRVARENJE/BLEEDING INCLUDE
  4.  
  5.  
  6. Author: tayloR
  7. Credits: X
  8. Date: 01/08/2021
  9.  
  10.  
  11. */
  12.  
  13. #if defined _INC_bleeding
  14. #endinput
  15. #endif
  16. #define _INC_bleeding
  17.  
  18. // ========================================================================== //
  19.  
  20. // >> PLAYER VARIABLE
  21. static _blood[MAX_PLAYERS];
  22.  
  23. // ========================================================================== //
  24. // >> PUBLICS
  25.  
  26. #if defined _INC_y_hooks
  27. hook OnPlayerUpdate(playerid) {
  28. #else
  29. public OnPlayerUpdate(playerid) {
  30. #endif
  31. if(!IsValidObject(_blood[playerid])) {
  32. new Float:health;
  33. GetPlayerHealth(playerid, health);
  34. if(health < 60 && !IsPlayerInWater(playerid)) {
  35. new Float:X, Float:Y, Float:Z;
  36. GetPlayerPos(playerid, X,Y,Z);
  37. _blood[playerid] = CreateObject(19836, X,Y,Z-0.95, 0,0,0);
  38. SetTimerEx("_bleeding", 2500, false, "i", playerid);
  39. }
  40. }
  41.  
  42. #if !defined _INC_y_hooks
  43. #if defined BLEEDING_OnPlayerUpdate
  44. return BLEEDING_OnPlayerUpdate(playerid);
  45. #else
  46. return 1;
  47. #endif
  48. #endif
  49. }
  50.  
  51.  
  52. #if !defined _INC_y_hooks
  53. #if defined _ALS_OnPlayerUpdate
  54. #undef OnPlayerUpdate
  55. #else
  56. #define _ALS_OnPlayerUpdate
  57. #endif
  58. #define OnPlayerUpdate BLEEDING_OnPlayerUpdate
  59. #if defined BLEEDING_OnPlayerUpdate
  60. forward BLEEDING_OnPlayerUpdate(playerid);
  61. #endif
  62. #endif
  63.  
  64. // ========================================================================== //
  65. // >> FUNCTIONS
  66.  
  67. forward _bleeding(playerid);
  68. public _bleeding(playerid) {
  69.  
  70. DestroyObject(_blood[playerid]);
  71. return 1;
  72. }
  73.  
  74. stock IsPlayerInWater(playerid)
  75. {
  76. new Float:Z_C;
  77. GetPlayerPos(playerid,Z_C,Z_C,Z_C);
  78. if(Z_C < 0.7) switch(GetPlayerAnimationIndex(playerid)) { case 1543,1538,1539: return true; }
  79. if(GetPlayerDistanceFromPoint(playerid,-965,2438,42) <= 700 && Z_C < 45) return true;
  80. new Float:water_places[][] =
  81. {
  82. {25.0, 2313.0, -1417.0, 23.0},
  83. {15.0, 1280.0, -773.0, 1082.0},
  84. {15.0, 1279.0, -804.0, 86.0},
  85. {20.0, 1094.0, -674.0, 111.0},
  86. {26.0, 194.0, -1232.0, 76.0},
  87. {25.0, 2583.0, 2385.0, 15.0},
  88. {25.0, 225.0, -1187.0, 73.0},
  89. {50.0, 1973.0, -1198.0, 17.0}
  90. };
  91. for(new t=0; t < sizeof water_places; t++)
  92. if(GetPlayerDistanceFromPoint(playerid,water_places[t][1],water_places[t][2],water_places[t][3]) <= water_places[t][0]) return true;
  93. return false;
  94. }
  95.  
  96. // ========================================================================== //
Advertisement
Add Comment
Please, Sign In to add comment