Advertisement
Guest User

Untitled

a guest
May 3rd, 2021
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.05 KB | None | 0 0
  1. function OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) {
  2.     new Float:HP, Float:AP, Float:remainHP;
  3.     if(issuerid != INVALID_PLAYER_ID) {
  4.         if(weaponid == 54 && GetPlayerState(issuerid) != PLAYER_STATE_DRIVER) {
  5.             if(playerdeath[issuerid] == 0) {
  6.                 GetPlayerHealthEx(issuerid,HP);
  7.                 GetPlayerArmourEx(issuerid,AP);
  8.                 if ( AP >= amount ) {
  9.                     SetPlayerArmourEx( issuerid, AP - amount );
  10.                     SetPlayerHealthEx( issuerid, HP );
  11.                 }
  12.                 else if ( AP <= 0 ) {
  13.                     remainHP = HP - amount;
  14.                     SetPlayerHealthEx( issuerid, remainHP );
  15.                     if ( remainHP <= 0 && playerdeath[issuerid] == 0 )
  16.                     {
  17.                         OnPlayerDeath( playerid, issuerid, weaponid );
  18.                         playerdeath[playerid] = 1;
  19.                     }
  20.                 }
  21.                 else {
  22.                     remainHP = HP + ( AP - amount );
  23.                     SetPlayerArmourEx( issuerid, 0.0 );
  24.                     SetPlayerHealthEx( issuerid, remainHP );
  25.                     if ( remainHP <= 0 && playerdeath[issuerid] == 0 )
  26.                     {
  27.                         OnPlayerDeath( playerid, issuerid, weaponid );
  28.                         playerdeath[issuerid] = 1;
  29.                     }
  30.                 }
  31.             }
  32.         }
  33.     }
  34.     if(weaponid == 49 || weaponid == 50 || weaponid == 51 || weaponid == 52 || weaponid == 53 || weaponid == 54 || GetPlayerState(issuerid) == PLAYER_STATE_DRIVER) {
  35.         if(playerdeath[playerid] == 0) {
  36.             GetPlayerHealthEx(playerid,HP);
  37.             GetPlayerArmourEx(playerid,AP);
  38.             if ( AP >= amount ) {
  39.                 SetPlayerArmourEx( playerid, AP - amount );
  40.                 SetPlayerHealthEx( playerid, HP );
  41.             }
  42.             else if ( AP <= 0 ) {
  43.                 remainHP = HP - amount;
  44.                 SetPlayerHealthEx( playerid, remainHP );
  45.                 if ( remainHP <= 0 && playerdeath[playerid] == 0 ) {
  46.                     OnPlayerDeath( playerid, issuerid, weaponid );
  47.                     playerdeath[playerid] = 1;
  48.                 }
  49.             }
  50.             else {
  51.                 remainHP = HP + ( AP - amount );
  52.                 SetPlayerArmourEx( playerid, 0.0 );
  53.                 SetPlayerHealthEx( playerid, remainHP );
  54.                 if ( remainHP <= 0 && playerdeath[playerid] == 0 ) {
  55.                     OnPlayerDeath( playerid, issuerid, weaponid );
  56.                     playerdeath[playerid] = 1;
  57.                 }
  58.             }
  59.         }
  60.     }
  61.     else {
  62.         if(playerdeath[playerid] == 0) {
  63.             GetPlayerHealthEx(playerid,HP);
  64.             GetPlayerArmourEx(playerid,AP);
  65.             if(AP >= amount ) {
  66.                 SetPlayerArmourEx(playerid, AP - amount);
  67.                 SetPlayerHealthEx(playerid, HP);
  68.             }
  69.             else if(AP <= 0) {
  70.                 remainHP = HP - amount;
  71.                 SetPlayerHealthEx(playerid, remainHP);
  72.                 if(remainHP <= 0 && playerdeath[playerid] == 0) {
  73.                     OnPlayerDeath(playerid, INVALID_PLAYER_ID, weaponid);
  74.                     playerdeath[playerid] = 1;
  75.                 }
  76.             }
  77.             else {
  78.                 remainHP = HP + (AP - amount);
  79.                 SetPlayerArmourEx(playerid, 0.0);
  80.                 SetPlayerHealthEx(playerid, remainHP);
  81.                 if( remainHP <= 0 && playerdeath[playerid] == 0) {
  82.                     OnPlayerDeath(playerid, INVALID_PLAYER_ID, weaponid );
  83.                     playerdeath[playerid] = 1;
  84.                 }
  85.             }
  86.         }
  87.     }
  88.     return 1;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement