Advertisement
Guest User

Stock

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