Advertisement
Guest User

Untitled

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