Advertisement
SalvatorCodes

Vehicle Damage Enabler [Alpha v1.0]

Mar 3rd, 2016
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.49 KB | None | 0 0
  1. /*************************************
  2. **************************************
  3. ******* Vehicle Damage Enabler *******
  4. *******[Alpha v1.0] by Salvator ******
  5. **************************************
  6. **************************************/
  7.  
  8. #include <a_samp>
  9.  
  10. public OnFilterScriptInit()
  11. {
  12.     print("Vehicle Damage Enabler [Alpha v1.0], by Salvator");
  13.     return 1;
  14. }
  15.  
  16. VehicleHasDriver(vehicleid) //Not sure who originally made this function, this is with my small edit
  17. {
  18.     for(new i=0; i<= MAX_PLAYERS; i++)
  19.     {
  20.         if(IsPlayerInAnyVehicle(i))
  21.         {
  22.             if(GetPlayerVehicleID(i) == vehicleid)
  23.             {
  24.                 if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
  25.                 {
  26.                     return 1;
  27.                 }
  28.             }
  29.         }
  30.     }
  31.     return 0;
  32. }
  33.  
  34. IsAirModel(modelid) //Thanks and credits goes to AmigaBlizzard for showing me this function
  35. {
  36.     switch(modelid)
  37.     {
  38.         case 460, 476, 511, 512, 513, 519, 520, 553, 577, 592, 593, 417, 425, 447, 469, 487, 488, 497, 548, 563:
  39.         return 1;
  40.     }
  41.     return 0;
  42. }
  43.  
  44. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  45. {
  46.     if(hittype == 2 && !VehicleHasDriver(hitid))
  47.     {
  48.         new wID = weaponid;
  49.         new Float:vHealth; GetVehicleHealth(hitid, vHealth);
  50.         if(IsAirModel(GetVehicleModel(hitid)) == 1)
  51.         {
  52.             if(wID == 28 || wID == 32) SetVehicleHealth(hitid, vHealth - 8);
  53.             if(wID == 22 || wID == 29) SetVehicleHealth(hitid, vHealth - 10);
  54.             if(wID == 30 || wID == 31) SetVehicleHealth(hitid, vHealth - 12);
  55.             if(wID == 23) SetVehicleHealth(hitid, vHealth - 16);
  56.             if(wID == 33) SetVehicleHealth(hitid, vHealth - 30);
  57.             if(wID == 27) SetVehicleHealth(hitid, vHealth - 48);
  58.             if(wID == 34) SetVehicleHealth(hitid, vHealth - 50);
  59.             if(wID == 24 || wID == 38) SetVehicleHealth(hitid, vHealth - 56);
  60.             if(wID == 25 || wID == 26) SetVehicleHealth(hitid, vHealth - 60);
  61.         }
  62.         else
  63.         {
  64.             if(wID == 28 || wID == 32) SetVehicleHealth(hitid, vHealth - 20);
  65.             if(wID == 22 || wID == 29) SetVehicleHealth(hitid, vHealth - 25);
  66.             if(wID == 30 || wID == 31) SetVehicleHealth(hitid, vHealth - 30);
  67.             if(wID == 23) SetVehicleHealth(hitid, vHealth - 40);
  68.             if(wID == 33) SetVehicleHealth(hitid, vHealth - 75);
  69.             if(wID == 27) SetVehicleHealth(hitid, vHealth - 120);
  70.             if(wID == 34) SetVehicleHealth(hitid, vHealth - 125);
  71.             if(wID == 24 || wID == 38) SetVehicleHealth(hitid, vHealth - 140);
  72.             if(wID == 25 || wID == 26) SetVehicleHealth(hitid, vHealth - 150);
  73.         }
  74.     }
  75.     return 1;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement