Advertisement
Guest User

Untitled

a guest
Oct 12th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.35 KB | None | 0 0
  1. // Vehicle Damage System by nesguide2
  2. //------------------------------------------------------------------------------
  3. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  4. {
  5.     new Float:VHP;
  6.     if(hittype == 2)
  7.     {
  8.         GetVehicleHealth(hitid, VHP);
  9.         if(!VehicleOccupied(hitid))
  10.         {
  11.             if(IsAirVehicle(hitid))
  12.             {
  13.                 switch(weaponid)
  14.                 {
  15.                     case 22:
  16.                     {
  17.                         if(VHP > 250)
  18.                         {
  19.                             SetVehicleHealth(hitid, VHP-8);
  20.                         }
  21.                     }
  22.                     case 23:
  23.                     {
  24.                         if(VHP > 250)
  25.                         {
  26.                             SetVehicleHealth(hitid, VHP-13);
  27.                         }
  28.                     }
  29.                     case 24:
  30.                     {
  31.                         if(VHP > 250)
  32.                         {
  33.                             SetVehicleHealth(hitid, VHP-46);
  34.                         }
  35.                     }
  36.                     case 25..26:
  37.                     {
  38.                         if(VHP > 250)
  39.                         {
  40.                             SetVehicleHealth(hitid, VHP-15);
  41.                         }
  42.                     }
  43.                     case 27:
  44.                     {
  45.                         if(VHP > 250)
  46.                         {
  47.                             SetVehicleHealth(hitid, VHP-19);
  48.                         }
  49.                     }
  50.                     case 28:
  51.                     {
  52.                         if(VHP > 250)
  53.                         {
  54.                             SetVehicleHealth(hitid, VHP-6);
  55.                         }
  56.                     }
  57.                     case 29:
  58.                     {
  59.                         if(VHP > 250)
  60.                         {
  61.                             SetVehicleHealth(hitid, VHP-8);
  62.                         }
  63.                     }
  64.                     case 30..31:
  65.                     {
  66.                         if(VHP > 250)
  67.                         {
  68.                             SetVehicleHealth(hitid, VHP-10);
  69.                         }
  70.                     }
  71.                     case 32:
  72.                     {
  73.                         if(VHP > 250)
  74.                         {
  75.                             SetVehicleHealth(hitid, VHP-6);
  76.                         }
  77.                     }
  78.                     case 33:
  79.                     {
  80.                         if(VHP > 250)
  81.                         {
  82.                             SetVehicleHealth(hitid, VHP-25);
  83.                         }
  84.                     }
  85.                     case 34:
  86.                     {
  87.                         if(VHP > 250)
  88.                         {
  89.                             SetVehicleHealth(hitid, VHP-41);
  90.                         }
  91.                     }
  92.                     case 38:
  93.                     {
  94.                         if(VHP > 250)
  95.                         {
  96.                             SetVehicleHealth(hitid, VHP-46);
  97.                         }
  98.                     }
  99.                 }
  100.             }
  101.             else if(!IsAirVehicle(hitid))
  102.             {
  103.                 switch(weaponid)
  104.                 {
  105.                     case 22:
  106.                     {
  107.                         if(VHP > 250)
  108.                         {
  109.                             SetVehicleHealth(hitid, VHP-25);
  110.                         }
  111.                     }
  112.                     case 23:
  113.                     {
  114.                         if(VHP > 250)
  115.                         {
  116.                             SetVehicleHealth(hitid, VHP-40);
  117.                         }
  118.                     }
  119.                     case 24:
  120.                     {
  121.                         if(VHP > 250)
  122.                         {
  123.                             SetVehicleHealth(hitid, VHP-140);
  124.                         }
  125.                     }
  126.                     case 25..26:
  127.                     {
  128.                         if(VHP > 250)
  129.                         {
  130.                             SetVehicleHealth(hitid, VHP-31);
  131.                         }
  132.                     }
  133.                     case 27:
  134.                     {
  135.                         if(VHP > 250)
  136.                         {
  137.                             SetVehicleHealth(hitid, VHP-38);
  138.                         }
  139.                     }
  140.                     case 28:
  141.                     {
  142.                         if(VHP > 250)
  143.                         {
  144.                             SetVehicleHealth(hitid, VHP-20);
  145.                         }
  146.                     }
  147.                     case 29:
  148.                     {
  149.                         if(VHP > 250)
  150.                         {
  151.                             SetVehicleHealth(hitid, VHP-25);
  152.                         }
  153.                     }
  154.                     case 30..31:
  155.                     {
  156.                         if(VHP > 250)
  157.                         {
  158.                             SetVehicleHealth(hitid, VHP-30);
  159.                         }
  160.                     }
  161.                     case 32:
  162.                     {
  163.                         if(VHP > 250)
  164.                         {
  165.                             SetVehicleHealth(hitid, VHP-20);
  166.                         }
  167.                     }
  168.                     case 33:
  169.                     {
  170.                         if(VHP > 250)
  171.                         {
  172.                             SetVehicleHealth(hitid, VHP-75);
  173.                         }
  174.                     }
  175.                     case 34:
  176.                     {
  177.                         if(VHP > 250)
  178.                         {
  179.                             SetVehicleHealth(hitid, VHP-125);
  180.                         }
  181.                     }
  182.                     case 38:
  183.                     {
  184.                         if(VHP > 250)
  185.                         {
  186.                             SetVehicleHealth(hitid, VHP-140);
  187.                         }
  188.                     }
  189.                 }
  190.             }
  191.         }
  192.         else
  193.         {
  194.             if(IsAirVehicle(hitid))
  195.             {
  196.                 switch(weaponid)
  197.                 {
  198.                     case 22:
  199.                     {
  200.                         if(VHP > 250)
  201.                         {
  202.                             SetVehicleHealth(hitid, VHP-8);
  203.                         }
  204.                     }
  205.                     case 23:
  206.                     {
  207.                         if(VHP > 250)
  208.                         {
  209.                             SetVehicleHealth(hitid, VHP-13);
  210.                         }
  211.                     }
  212.                     case 24:
  213.                     {
  214.                         if(VHP > 250)
  215.                         {
  216.                             SetVehicleHealth(hitid, VHP-46);
  217.                         }
  218.                     }
  219.                     case 25..26:
  220.                     {
  221.                         if(VHP > 250)
  222.                         {
  223.                             SetVehicleHealth(hitid, VHP-15);
  224.                         }
  225.                     }
  226.                     case 27:
  227.                     {
  228.                         if(VHP > 250)
  229.                         {
  230.                             SetVehicleHealth(hitid, VHP-19);
  231.                         }
  232.                     }
  233.                     case 28:
  234.                     {
  235.                         if(VHP > 250)
  236.                         {
  237.                             SetVehicleHealth(hitid, VHP-6);
  238.                         }
  239.                     }
  240.                     case 29:
  241.                     {
  242.                         if(VHP > 250)
  243.                         {
  244.                             SetVehicleHealth(hitid, VHP-8);
  245.                         }
  246.                     }
  247.                     case 30..31:
  248.                     {
  249.                         if(VHP > 250)
  250.                         {
  251.                             SetVehicleHealth(hitid, VHP-10);
  252.                         }
  253.                     }
  254.                     case 32:
  255.                     {
  256.                         if(VHP > 250)
  257.                         {
  258.                             SetVehicleHealth(hitid, VHP-6);
  259.                         }
  260.                     }
  261.                     case 33:
  262.                     {
  263.                         if(VHP > 250)
  264.                         {
  265.                             SetVehicleHealth(hitid, VHP-25);
  266.                         }
  267.                     }
  268.                     case 34:
  269.                     {
  270.                         if(VHP > 250)
  271.                         {
  272.                             SetVehicleHealth(hitid, VHP-41);
  273.                         }
  274.                     }
  275.                     case 38:
  276.                     {
  277.                         if(VHP > 250)
  278.                         {
  279.                             SetVehicleHealth(hitid, VHP-46);
  280.                         }
  281.                     }
  282.                 }
  283.             }
  284.             else if(!IsAirVehicle(hitid))
  285.             {
  286.                 switch(weaponid)
  287.                 {
  288.                     case 22:
  289.                     {
  290.                         if(VHP > 250)
  291.                         {
  292.                             SetVehicleHealth(hitid, VHP-25);
  293.                         }
  294.                     }
  295.                     case 23:
  296.                     {
  297.                         if(VHP > 250)
  298.                         {
  299.                             SetVehicleHealth(hitid, VHP-40);
  300.                         }
  301.                     }
  302.                     case 24:
  303.                     {
  304.                         if(VHP > 250)
  305.                         {
  306.                             SetVehicleHealth(hitid, VHP-140);
  307.                         }
  308.                     }
  309.                     case 25..26:
  310.                     {
  311.                         if(VHP > 250)
  312.                         {
  313.                             SetVehicleHealth(hitid, VHP-31);
  314.                         }
  315.                     }
  316.                     case 27:
  317.                     {
  318.                         if(VHP > 250)
  319.                         {
  320.                             SetVehicleHealth(hitid, VHP-38);
  321.                         }
  322.                     }
  323.                     case 28:
  324.                     {
  325.                         if(VHP > 250)
  326.                         {
  327.                             SetVehicleHealth(hitid, VHP-20);
  328.                         }
  329.                     }
  330.                     case 29:
  331.                     {
  332.                         if(VHP > 250)
  333.                         {
  334.                             SetVehicleHealth(hitid, VHP-25);
  335.                         }
  336.                     }
  337.                     case 30..31:
  338.                     {
  339.                         if(VHP > 250)
  340.                         {
  341.                             SetVehicleHealth(hitid, VHP-30);
  342.                         }
  343.                     }
  344.                     case 32:
  345.                     {
  346.                         if(VHP > 250)
  347.                         {
  348.                             SetVehicleHealth(hitid, VHP-20);
  349.                         }
  350.                     }
  351.                     case 33:
  352.                     {
  353.                         if(VHP > 250)
  354.                         {
  355.                             SetVehicleHealth(hitid, VHP-75);
  356.                         }
  357.                     }
  358.                     case 34:
  359.                     {
  360.                         if(VHP > 250)
  361.                         {
  362.                             SetVehicleHealth(hitid, VHP-125);
  363.                         }
  364.                     }
  365.                     case 38:
  366.                     {
  367.                         if(VHP > 250)
  368.                         {
  369.                             SetVehicleHealth(hitid, VHP-140);
  370.                         }
  371.                     }
  372.                 }
  373.             }
  374.         }
  375.     }
  376.     return 1;
  377. }
  378.  
  379. stock IsAirVehicle(vehicleid)
  380. {
  381.     switch(GetVehicleModel(vehicleid))
  382.     {
  383.         case 417,425,447,460,469,476,487,488,497,511,512,513,519,520,548,553,563,577,592,593: return 1;
  384.     }
  385.     return 0;
  386. }
  387.  
  388. forward VehicleOccupied(vehicleid);
  389. public VehicleOccupied(vehicleid)
  390. {
  391.     for(new i=0;i<MAX_PLAYERS;i++)
  392.     {
  393.         if(IsPlayerInVehicle(i,vehicleid)) return 1;
  394.     }
  395.     return 0;
  396. }
  397. //------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement