Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined _INC_bleeding
- #endinput
- #endif
- #define _INC_bleeding
- static _inc_bleeding_blood[MAX_PLAYERS];
- #if defined _INC_y_hooks
- hook OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) {
- #else
- public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) {
- #endif
- new Float:h;
- GetPlayerHealth(playerid, h);
- if(h<60) SetTimerEx("_bleedingcheck", 2500, false, "i", playerid);
- #if !defined _INC_y_hooks
- #if defined BLEEDING_OnPlayerTakeDamage
- return BLEEDING_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart);
- #else
- return 1;
- #endif
- #endif
- }
- #if !defined _INC_y_hooks
- #if defined _ALS_OnPlayerTakeDamage
- #undef OnPlayerTakeDamage
- #else
- #define _ALS_OnPlayerTakeDamage
- #endif
- #define OnPlayerTakeDamage BLEEDING_OnPlayerTakeDamage
- #if defined BLEEDING_OnPlayerTakeDamage
- forward BLEEDING_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart);
- #endif
- #endif
- forward _bleedingcheck(playerid);
- public _bleedingcheck(playerid) {
- if(IsValidDynamicObject(_inc_bleeding_blood[playerid])) {
- DestroyDynamicObject(_inc_bleeding_blood[playerid]);
- return SetTimerEx("_bleedingcheck", 2500, false, "i", playerid);
- }
- new Float:health;
- GetPlayerHealth(playerid, health);
- if(health > 60) return 0;
- if(IsPlayerInWater(playerid) || Falling(playerid)) return SetTimerEx("_bleedingcheck", 2500, false, "i", playerid);
- new Float:tX, Float:tY, Float:tZ;
- GetPlayerPos(playerid, tX,tY,tZ);
- _inc_bleeding_blood[playerid] = CreateDynamicObject(19836, tX,tY,tZ-0.95, 0,0,0);
- return SetTimerEx("_bleedingcheck", 2500, false, "i", playerid);
- }
- static stock IsPlayerInWater(playerid)
- {
- new Float:Z_C;
- GetPlayerPos(playerid,Z_C,Z_C,Z_C);
- if(Z_C < 0.7) switch(GetPlayerAnimationIndex(playerid)) { case 1543,1538,1539: return true; }
- if(GetPlayerDistanceFromPoint(playerid,-965,2438,42) <= 700 && Z_C < 45) return true;
- new Float:water_places[][] =
- {
- {25.0, 2313.0, -1417.0, 23.0},
- {15.0, 1280.0, -773.0, 1082.0},
- {15.0, 1279.0, -804.0, 86.0},
- {20.0, 1094.0, -674.0, 111.0},
- {26.0, 194.0, -1232.0, 76.0},
- {25.0, 2583.0, 2385.0, 15.0},
- {25.0, 225.0, -1187.0, 73.0},
- {50.0, 1973.0, -1198.0, 17.0}
- };
- for(new t=0; t < sizeof water_places; t++)
- if(GetPlayerDistanceFromPoint(playerid,water_places[t][1],water_places[t][2],water_places[t][3]) <= water_places[t][0]) return true;
- return false;
- }
- static stock Falling(playerid)
- {
- new const index = GetPlayerAnimationIndex(playerid);
- if(index >= 958 && index <= 979 || index == 1130 || index == 1195 || index == 1132 || index >= 1195 && index <= 1198) return 1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment