iFarbod

WeaponStore samp script for my thing

Mar 22nd, 2014
411
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 30.84 KB | None | 0 0
  1. /**
  2.  * This is free and unencumbered software released into the public domain.
  3.  *
  4.  * Anyone is free to copy, modify, publish, use, compile, sell, or
  5.  * distribute this software, either in source code form or as a compiled
  6.  * binary, for any purpose, commercial or non-commercial, and by any
  7.  * means.
  8.  *
  9.  * In jurisdictions that recognize copyright laws, the author or authors
  10.  * of this software dedicate any and all copyright interest in the
  11.  * software to the public domain. We make this dedication for the benefit
  12.  * of the public at large and to the detriment of our heirs and
  13.  * successors. We intend this dedication to be an overt act of
  14.  * relinquishment in perpetuity of all present and future rights to this
  15.  * software under copyright law.
  16.  *
  17.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18.  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19.  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20.  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  21.  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  22.  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  23.  * OTHER DEALINGS IN THE SOFTWARE.
  24.  *
  25.  * For more information, please refer to <http://unlicense.org/>
  26. */
  27.  
  28. /*============================================================*\
  29.     FileName                    : iWeaponStore.pwn
  30.     FilterScript/Gamemode Name  : iFarbod Weapon Store
  31.     Version                     : 1.0.0
  32.     Author                      : iFarbod <http://ifarbod.webs.com>
  33.     License                     : Unlicense <http://unlicense.org/>
  34.     Started Coding on           : 2014/03/19 23:55
  35.     Finished Coding on          : 2014/03/22 14:23
  36. \*============================================================*/
  37.  
  38. /*============================================================*\
  39.     Credits :
  40.     Zeex for ZCMD
  41.     Y_Less for SSCANF, YSI, Whirlpool plugin and foreach
  42.     ITB CompuPhase for PAWN
  43.     SA:MP Team for both SA:MP Client and server
  44. \*============================================================*/
  45.  
  46. /* =========  DEFINES ========= */
  47. #define DIALOG_IWSTORE 90
  48. #define DIALOG_IWSTORE_MELEE 93
  49. #define DIALOG_IWSTORE_HANDGUN 94
  50. #define DIALOG_IWSTORE_SUBMACHINEGUN 95
  51. #define DIALOG_IWSTORE_ASSAULTRIFLE 96
  52. #define DIALOG_IWSTORE_SNIPERRIFLE 97
  53. #define DIALOG_IWSTORE_SHOTGUN 98
  54. #define DIALOG_IWSTORE_HEAVY 99
  55. #define DIALOG_IWSTORE_PROJECTILE 100
  56.  
  57. // Colors
  58. #define COLOR_DEFAULT 0xE6E6E6FF
  59. #define COLOR_PRIMARY 0x3071A9FF
  60. #define COLOR_SUCCESS 0x449D44FF
  61. #define COLOR_INFO 0x31B0D5FF
  62. #define COLOR_WARNING 0xEC971FFF
  63. #define COLOR_DANGER 0xC9302CFF
  64.  
  65. /* =========  INCLUDES ========= */
  66. #include <a_samp>
  67. #include <zcmd>
  68. // #include <sscanf2>
  69. #include <YSI\y_ini>
  70.  
  71. /* =========  VARS ========= */
  72. new
  73.     KnifePrice,
  74.     NightstickPrice,
  75.     PistolPrice,
  76.     CombatPistolPrice,
  77.     MicroSMGPrice,
  78.     SMGPrice,
  79.     AssaultRiflePrice,
  80.     CarbineRiflePrice,
  81.     SniperRiflePrice,
  82.     AssaultShotgunPrice,
  83.     PumpShotgunPrice,
  84.     SawedOffShotgunPrice,
  85.     GrenadeLauncherPrice,
  86.     MinigunPrice,
  87.     RPGPrice,
  88.     GrenadePrice,
  89.     TearGasPrice;
  90.  
  91. /* =========  FORWARDS ========= */
  92. forward LoadINIData(name[], value[]); // thanks to Y_Less
  93.  
  94. /* =========  PUBLIC FUNCS ========= */
  95. public LoadINIData(name[], value[])
  96. {
  97.     INI_Int("KnifePrice", KnifePrice);
  98.     INI_Int("NightstickPrice", NightstickPrice);
  99.     INI_Int("PistolPrice", PistolPrice);
  100.     INI_Int("CombatPistolPrice", CombatPistolPrice);
  101.     INI_Int("MicroSMGPrice", MicroSMGPrice);
  102.     INI_Int("SMGPrice", SMGPrice);
  103.     INI_Int("AssaultRiflePrice", AssaultRiflePrice);
  104.     INI_Int("CarbineRiflePrice", CarbineRiflePrice);
  105.     INI_Int("SniperRiflePrice", SniperRiflePrice);
  106.     INI_Int("AssaultShotgunPrice", AssaultShotgunPrice);
  107.     INI_Int("PumpShotgunPrice", PumpShotgunPrice);
  108.     INI_Int("SawedOffShotgunPrice", SawedOffShotgunPrice);
  109.     INI_Int("GrenadeLauncherPrice", GrenadeLauncherPrice);
  110.     INI_Int("MinigunPrice", MinigunPrice);
  111.     INI_Int("RPGPrice", RPGPrice);
  112.     INI_Int("GrenadePrice", GrenadePrice);
  113.     // INI_Int("MolotovPrice", MolotovPrice);
  114.     INI_Int("TearGasPrice", TearGasPrice);
  115.     return 1;
  116. }
  117.  
  118. /* =========  FS CALLBACKS ========= */
  119. public OnFilterScriptInit()
  120. {
  121.     print("\n=============================================");
  122.     print(" iWeaponStore Filterscript by iFarbod loaded");
  123.     print("=============================================\n");
  124.     INI_ParseFile("iWStore.ini", "LoadINIData"); // thanks to Y_Less
  125.     return 1;
  126. }
  127.  
  128. public OnFilterScriptExit()
  129. {
  130.     return 1;
  131. }
  132.  
  133. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  134. {
  135.     switch(dialogid)
  136.     {
  137.         case DIALOG_IWSTORE:
  138.         {
  139.             if(response)
  140.             {
  141.                 switch(listitem)
  142.                 {
  143.                     case 0:
  144.                     {
  145.                         if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  146.                         ShowMeleeCat(playerid);
  147.                     }
  148.                     case 1:
  149.                     {
  150.                         if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  151.                         ShowHandGunCat(playerid);
  152.                     }
  153.                     case 2:
  154.                     {
  155.                         if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  156.                         ShowSubmachineGunCat(playerid);
  157.                     }
  158.                     case 3:
  159.                     {
  160.                         if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  161.                         ShowAssaultRifleCat(playerid);
  162.                     }
  163.                     case 4:
  164.                     {
  165.                         if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  166.                         ShowSniperRifleCat(playerid);
  167.                     }
  168.                     case 5:
  169.                     {
  170.                         if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  171.                         ShowShotgunCat(playerid);
  172.                     }
  173.                     case 6:
  174.                     {
  175.                         if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  176.                         ShowHeavyCat(playerid);
  177.                     }
  178.                     case 7:
  179.                     {
  180.                         if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  181.                         ShowProjectileCat(playerid);
  182.                     }
  183.                 }
  184.             }
  185.         }
  186.         case DIALOG_IWSTORE_MELEE:
  187.         {
  188.             if(response)
  189.             {
  190.                 switch(listitem)
  191.                 {
  192.                     case 0: // Knife
  193.                     {
  194.                         if(GetPlayerMoney(playerid) >= KnifePrice)
  195.                         {
  196.                             if(IsPlayerSpawned(playerid))
  197.                             {
  198.                                 GivePlayerMoney(playerid, -KnifePrice);
  199.                                 GivePlayerWeapon(playerid, WEAPON_KNIFE, 1);
  200.                                 ShowMeleeCat(playerid);
  201.                             }
  202.                             else
  203.                             {
  204.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  205.                             }
  206.                         }
  207.                         else
  208.                         {
  209.                             ShowMoneyError(playerid);
  210.                             ShowMeleeCat(playerid);
  211.                         }
  212.                     }
  213.                     case 1: // Nightstick
  214.                     {
  215.                         if(GetPlayerMoney(playerid) >= NightstickPrice)
  216.                         {
  217.                             if(IsPlayerSpawned(playerid))
  218.                             {
  219.                                 GivePlayerMoney(playerid, -NightstickPrice);
  220.                                 GivePlayerWeapon(playerid, WEAPON_NITESTICK, 1);
  221.                                 ShowMeleeCat(playerid);
  222.                             }
  223.                             else
  224.                             {
  225.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  226.                             }
  227.                         }
  228.                         else
  229.                         {
  230.                             ShowMoneyError(playerid);
  231.                             ShowMeleeCat(playerid);
  232.                         }
  233.                     }
  234.                 }
  235.             }
  236.             else
  237.             {
  238.                 if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  239.                 ShowWeaponCats(playerid);
  240.             }
  241.         }
  242.         case DIALOG_IWSTORE_HANDGUN:
  243.         {
  244.             if(response)
  245.             {
  246.                 switch(listitem)
  247.                 {
  248.                     case 0: // Pistol
  249.                     {
  250.                         if(GetPlayerMoney(playerid) >= PistolPrice)
  251.                         {
  252.                             if(IsPlayerSpawned(playerid))
  253.                             {
  254.                                 GivePlayerMoney(playerid, -PistolPrice);
  255.                                 GivePlayerWeapon(playerid, WEAPON_COLT45, 100);
  256.                                 ShowHandGunCat(playerid);
  257.                             }
  258.                             else
  259.                             {
  260.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  261.                             }
  262.                         }
  263.                         else
  264.                         {
  265.                             ShowMoneyError(playerid);
  266.                             ShowHandGunCat(playerid);
  267.                         }
  268.                     }
  269.                     case 1: // Combat Pistol (Desert Eagle)
  270.                     {
  271.                         if(GetPlayerMoney(playerid) >= CombatPistolPrice)
  272.                         {
  273.                             if(IsPlayerSpawned(playerid))
  274.                             {
  275.                                 GivePlayerMoney(playerid, -CombatPistolPrice);
  276.                                 GivePlayerWeapon(playerid, WEAPON_DEAGLE, 100);
  277.                                 ShowHandGunCat(playerid);
  278.                             }
  279.                             else
  280.                             {
  281.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  282.                             }
  283.                         }
  284.                         else
  285.                         {
  286.                             ShowMoneyError(playerid);
  287.                             ShowHandGunCat(playerid);
  288.                         }
  289.                     }
  290.                 }
  291.             }
  292.             else
  293.             {
  294.                 if(!IsPlayerSpawned(playerid)) SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  295.                 ShowWeaponCats(playerid);
  296.             }
  297.         }
  298.         case DIALOG_IWSTORE_SUBMACHINEGUN:
  299.         {
  300.             if(response)
  301.             {
  302.                 switch(listitem)
  303.                 {
  304.                     case 0: // Micro SMG
  305.                     {
  306.                         if(GetPlayerMoney(playerid) >= MicroSMGPrice)
  307.                         {
  308.                             if(IsPlayerSpawned(playerid))
  309.                             {
  310.                                 GivePlayerMoney(playerid, -MicroSMGPrice);
  311.                                 GivePlayerWeapon(playerid, WEAPON_UZI, 150);
  312.                                 ShowSubmachineGunCat(playerid);
  313.                             }
  314.                             else
  315.                             {
  316.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  317.                             }
  318.                         }
  319.                         else
  320.                         {
  321.                             ShowMoneyError(playerid);
  322.                             ShowSubmachineGunCat(playerid);
  323.                         }
  324.                     }
  325.                     case 1: // SMG
  326.                     {
  327.                         if(GetPlayerMoney(playerid) >= SMGPrice)
  328.                         {
  329.                             if(IsPlayerSpawned(playerid))
  330.                             {
  331.                                 GivePlayerMoney(playerid, -SMGPrice);
  332.                                 GivePlayerWeapon(playerid, WEAPON_MP5, 120);
  333.                                 ShowSubmachineGunCat(playerid);
  334.                             }
  335.                             else
  336.                             {
  337.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  338.                             }
  339.                         }
  340.                         else
  341.                         {
  342.                             ShowMoneyError(playerid);
  343.                             ShowSubmachineGunCat(playerid);
  344.                         }
  345.                     }
  346.                 }
  347.             }
  348.             else
  349.             {
  350.                 if(!IsPlayerSpawned(playerid)) SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  351.                 ShowWeaponCats(playerid);
  352.             }
  353.         }
  354.         case DIALOG_IWSTORE_ASSAULTRIFLE:
  355.         {
  356.             if(response)
  357.             {
  358.                 switch(listitem)
  359.                 {
  360.                     case 0: // Assault Rifle (AK-47)
  361.                     {
  362.                         if(GetPlayerMoney(playerid) >= AssaultRiflePrice)
  363.                         {
  364.                             if(IsPlayerSpawned(playerid))
  365.                             {
  366.                                 GivePlayerMoney(playerid, -AssaultRiflePrice);
  367.                                 GivePlayerWeapon(playerid, WEAPON_AK47, 120);
  368.                                 ShowAssaultRifleCat(playerid);
  369.                             }
  370.                             else
  371.                             {
  372.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  373.                             }
  374.                         }
  375.                         else
  376.                         {
  377.                             ShowMoneyError(playerid);
  378.                             ShowAssaultRifleCat(playerid);
  379.                         }
  380.                     }
  381.                     case 1: // Carbine Rifle (M4)
  382.                     {
  383.                         if(GetPlayerMoney(playerid) >= CarbineRiflePrice)
  384.                         {
  385.                             if(IsPlayerSpawned(playerid))
  386.                             {
  387.                                 GivePlayerMoney(playerid, -CarbineRiflePrice);
  388.                                 GivePlayerWeapon(playerid, WEAPON_M4, 150);
  389.                                 ShowAssaultRifleCat(playerid);
  390.                             }
  391.                             else
  392.                             {
  393.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  394.                             }
  395.                         }
  396.                         else
  397.                         {
  398.                             ShowMoneyError(playerid);
  399.                             ShowAssaultRifleCat(playerid);
  400.                         }
  401.                     }
  402.                 }
  403.             }
  404.             else
  405.             {
  406.                 if(!IsPlayerSpawned(playerid)) SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  407.                 ShowWeaponCats(playerid);
  408.             }
  409.         }
  410.         case DIALOG_IWSTORE_SNIPERRIFLE:
  411.         {
  412.             if(response)
  413.             {
  414.                 switch(listitem)
  415.                 {
  416.                     case 0: // Sniper Rifle
  417.                     {
  418.                         if(GetPlayerMoney(playerid) >= SniperRiflePrice)
  419.                         {
  420.                             if(IsPlayerSpawned(playerid))
  421.                             {
  422.                                 GivePlayerMoney(playerid, -SniperRiflePrice);
  423.                                 GivePlayerWeapon(playerid, WEAPON_SNIPER, 21);
  424.                                 ShowSniperRifleCat(playerid);
  425.                             }
  426.                             else
  427.                             {
  428.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  429.                             }
  430.                         }
  431.                         else
  432.                         {
  433.                             ShowMoneyError(playerid);
  434.                             ShowSniperRifleCat(playerid);
  435.                         }
  436.                     }
  437.                 }
  438.             }
  439.             else
  440.             {
  441.                 if(!IsPlayerSpawned(playerid)) SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  442.                 ShowWeaponCats(playerid);
  443.             }
  444.         }
  445.         case DIALOG_IWSTORE_SHOTGUN:
  446.         {
  447.             if(response)
  448.             {
  449.                 switch(listitem)
  450.                 {
  451.                     case 0: // Assault Shotgun (SPAS-12/Combat Shotgun)
  452.                     {
  453.                         if(GetPlayerMoney(playerid) >= AssaultShotgunPrice)
  454.                         {
  455.                             if(IsPlayerSpawned(playerid))
  456.                             {
  457.                                 GivePlayerMoney(playerid, -AssaultShotgunPrice);
  458.                                 GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 100);
  459.                                 ShowShotgunCat(playerid);
  460.                             }
  461.                             else
  462.                             {
  463.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  464.                             }
  465.                         }
  466.                         else
  467.                         {
  468.                             ShowMoneyError(playerid);
  469.                             ShowShotgunCat(playerid);
  470.                         }
  471.                     }
  472.                     case 1: // Pump Shotgun (Pump Action Shotgun/Regular Shotgun)
  473.                     {
  474.                         if(GetPlayerMoney(playerid) >= PumpShotgunPrice)
  475.                         {
  476.                             if(IsPlayerSpawned(playerid))
  477.                             {
  478.                                 GivePlayerMoney(playerid, -PumpShotgunPrice);
  479.                                 GivePlayerWeapon(playerid, WEAPON_SHOTGUN, 150);
  480.                                 ShowShotgunCat(playerid);
  481.                             }
  482.                             else
  483.                             {
  484.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  485.                             }
  486.                         }
  487.                         else
  488.                         {
  489.                             ShowMoneyError(playerid);
  490.                             ShowShotgunCat(playerid);
  491.                         }
  492.                     }
  493.                     case 2: // Sawed Off Shotgun (Sawnoff)
  494.                     {
  495.                         if(GetPlayerMoney(playerid) >= SawedOffShotgunPrice)
  496.                         {
  497.                             if(IsPlayerSpawned(playerid))
  498.                             {
  499.                                 GivePlayerMoney(playerid, -SawedOffShotgunPrice);
  500.                                 GivePlayerWeapon(playerid, WEAPON_SAWEDOFF, 70);
  501.                                 ShowShotgunCat(playerid);
  502.                             }
  503.                             else
  504.                             {
  505.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  506.                             }
  507.                         }
  508.                         else
  509.                         {
  510.                             ShowMoneyError(playerid);
  511.                             ShowShotgunCat(playerid);
  512.                         }
  513.                     }
  514.                 }
  515.             }
  516.             else
  517.             {
  518.                 if(!IsPlayerSpawned(playerid)) SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  519.                 ShowWeaponCats(playerid);
  520.             }
  521.         }
  522.         case DIALOG_IWSTORE_HEAVY:
  523.         {
  524.             if(response)
  525.             {
  526.                 switch(listitem)
  527.                 {
  528.                     case 0: // Grenade Launcher
  529.                     {
  530.                         if(GetPlayerMoney(playerid) >= GrenadeLauncherPrice)
  531.                         {
  532.                             if(IsPlayerSpawned(playerid))
  533.                             {
  534.                                 GivePlayerMoney(playerid, -GrenadeLauncherPrice);
  535.                                 GivePlayerWeapon(playerid, WEAPON_HEATSEEKER, 5);
  536.                                 ShowHeavyCat(playerid);
  537.                             }
  538.                             else
  539.                             {
  540.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  541.                             }
  542.                         }
  543.                         else
  544.                         {
  545.                             ShowMoneyError(playerid);
  546.                             ShowHeavyCat(playerid);
  547.                         }
  548.                     }
  549.                     case 1: // Minigun
  550.                     {
  551.                         if(GetPlayerMoney(playerid) >= MinigunPrice)
  552.                         {
  553.                             if(IsPlayerSpawned(playerid))
  554.                             {
  555.                                 GivePlayerMoney(playerid, -MinigunPrice);
  556.                                 GivePlayerWeapon(playerid, WEAPON_MINIGUN, 500);
  557.                                 ShowHeavyCat(playerid);
  558.                             }
  559.                             else
  560.                             {
  561.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  562.                             }
  563.                         }
  564.                         else
  565.                         {
  566.                             ShowMoneyError(playerid);
  567.                             ShowHeavyCat(playerid);
  568.                         }
  569.                     }
  570.                     case 2: // RPG
  571.                     {
  572.                         if(GetPlayerMoney(playerid) >= RPGPrice)
  573.                         {
  574.                             if(IsPlayerSpawned(playerid))
  575.                             {
  576.                                 GivePlayerMoney(playerid, -RPGPrice);
  577.                                 GivePlayerWeapon(playerid, WEAPON_ROCKETLAUNCHER, 5);
  578.                                 ShowHeavyCat(playerid);
  579.                             }
  580.                             else
  581.                             {
  582.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  583.                             }
  584.                         }
  585.                         else
  586.                         {
  587.                             ShowMoneyError(playerid);
  588.                             ShowHeavyCat(playerid);
  589.                         }
  590.                     }
  591.                 }
  592.             }
  593.             else
  594.             {
  595.                 if(!IsPlayerSpawned(playerid)) SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  596.                 ShowWeaponCats(playerid);
  597.             }
  598.         }
  599.         case DIALOG_IWSTORE_PROJECTILE:
  600.         {
  601.             if(response)
  602.             {
  603.                 switch(listitem)
  604.                 {
  605.                     case 0: // Grenade
  606.                     {
  607.                         if(GetPlayerMoney(playerid) >= GrenadePrice)
  608.                         {
  609.                             if(IsPlayerSpawned(playerid))
  610.                             {
  611.                                 GivePlayerMoney(playerid, -GrenadePrice);
  612.                                 GivePlayerWeapon(playerid, WEAPON_GRENADE, 5);
  613.                                 ShowProjectileCat(playerid);
  614.                             }
  615.                             else
  616.                             {
  617.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  618.                             }
  619.                         }
  620.                         else
  621.                         {
  622.                             ShowMoneyError(playerid);
  623.                             ShowProjectileCat(playerid);
  624.                         }
  625.                     }
  626.                     case 1: // Tear Gas
  627.                     {
  628.                         if(GetPlayerMoney(playerid) >= TearGasPrice)
  629.                         {
  630.                             if(IsPlayerSpawned(playerid))
  631.                             {
  632.                                 GivePlayerMoney(playerid, -TearGasPrice);
  633.                                 GivePlayerWeapon(playerid, WEAPON_TEARGAS, 5);
  634.                                 ShowProjectileCat(playerid);
  635.                             }
  636.                             else
  637.                             {
  638.                                 return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  639.                             }
  640.                         }
  641.                         else
  642.                         {
  643.                             ShowMoneyError(playerid);
  644.                             ShowProjectileCat(playerid);
  645.                         }
  646.                     }
  647.                 }
  648.             }
  649.             else
  650.             {
  651.                 if(!IsPlayerSpawned(playerid)) SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  652.                 ShowWeaponCats(playerid);
  653.             }
  654.         }
  655.     }
  656.     return 1;
  657. }
  658.  
  659.  
  660. /* =========  CMDS ========= */
  661. CMD:weapons(playerid, params[])
  662. {
  663.     if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_DANGER, "You must spawned to do this!");
  664.     ShowWeaponCats(playerid);
  665.     return 1;
  666. }
  667.  
  668. CMD:gwna(playerid, params[])
  669. {
  670.     new
  671.         weaponid = GetPlayerWeapon(playerid);
  672.     if (GetPlayerMoney(playerid) >= 20000) {
  673.         GivePlayerWeapon(playerid, WEAPON_KNIFE, 1);
  674.         GivePlayerWeapon(playerid, WEAPON_MP5, 300);
  675.         GivePlayerWeapon(playerid, WEAPON_SHOTGUN, 150);
  676.         GivePlayerWeapon(playerid, WEAPON_AK47, 300);
  677.         GivePlayerWeapon(playerid, WEAPON_SNIPER, 30);
  678.         GivePlayerWeapon(playerid, WEAPON_GRENADE, 5);
  679.         GivePlayerWeapon(playerid, WEAPON_ROCKETLAUNCHER, 5);
  680.         SetPlayerArmedWeapon(playerid, weaponid);
  681.         GivePlayerMoney(playerid, -30000);
  682.         SendClientMessage(playerid, COLOR_SUCCESS, "You bought a full package of weapons and ammunition for $30,000");
  683.         return 1;
  684.     }
  685.     else {
  686.     SendClientMessage(playerid, COLOR_DANGER, "You must have $20,000 to buy this!");
  687.     return 1;
  688.     }
  689. }
  690. /*
  691. CMD:iwstore(playerid, params[])
  692. {
  693.     SendClientMessage(playerid, COLOR_SUCCESS, "Test!");
  694.     return 1;
  695. }
  696. */
  697.  
  698. /* =========  STOCKS ========= */
  699. stock IsPlayerSpawned(playerid)
  700. {
  701.     new
  702.         pstate = GetPlayerState(playerid);
  703.  
  704.     if(pstate != PLAYER_STATE_NONE && pstate != PLAYER_STATE_WASTED && pstate != PLAYER_STATE_SPAWNED)
  705.     {
  706.         return 1;
  707.     }
  708.  
  709.     else
  710.     {
  711.         return 0;
  712.     }
  713. }
  714.  
  715. /*
  716.  * In order to edit weapon name strings, captions and more, you can edit these functions.
  717.  */
  718. stock ShowWeaponCats(playerid)
  719. {
  720.     ShowPlayerDialog(playerid, DIALOG_IWSTORE, DIALOG_STYLE_LIST, "{E6E6E6}iFarbod Weapon Store", "Melee\nHand Gun\nSubmachine Gun\nAssault Rifle\nSniper Rifle\nShotgun\nHeavy\nProjectile", "Select", "Exit");
  721. }
  722.  
  723. stock ShowMeleeCat(playerid)
  724. {
  725.     new meleecatstr[256];
  726.     format(meleecatstr, sizeof(meleecatstr), "Knife     $%d\nNightstick     $%d", KnifePrice, NightstickPrice);
  727.     ShowPlayerDialog(playerid, DIALOG_IWSTORE_MELEE, DIALOG_STYLE_LIST, "{E6E6E6}Melee", meleecatstr, "Buy", "Back");
  728. }
  729.  
  730. stock ShowHandGunCat(playerid)
  731. {
  732.     new handguncatstr[256];
  733.     format(handguncatstr, sizeof(handguncatstr), "Pistol        $%d\nCombat Pistol      $%d", PistolPrice, CombatPistolPrice);
  734.     ShowPlayerDialog(playerid, DIALOG_IWSTORE_HANDGUN, DIALOG_STYLE_LIST, "{E6E6E6}Hand Gun", handguncatstr, "Buy", "Back");
  735. }
  736.  
  737. stock ShowSubmachineGunCat(playerid)
  738. {
  739.     new submachinegunstr[256];
  740.     format(submachinegunstr, sizeof(submachinegunstr), "Micro SMG       $%d\nSMG        $%d", MicroSMGPrice, SMGPrice);
  741.     ShowPlayerDialog(playerid, DIALOG_IWSTORE_SUBMACHINEGUN, DIALOG_STYLE_LIST, "{E6E6E6}Submachine Gun", submachinegunstr, "Buy", "Back");
  742. }
  743.  
  744. stock ShowAssaultRifleCat(playerid)
  745. {
  746.     new assaultriflecatstr[256];
  747.     format(assaultriflecatstr, sizeof(assaultriflecatstr), "Assault Rifle       $%d\nCarbine Rifle      $%d", AssaultRiflePrice, CarbineRiflePrice);
  748.     ShowPlayerDialog(playerid, DIALOG_IWSTORE_ASSAULTRIFLE, DIALOG_STYLE_LIST, "{E6E6E6}Assault Rifle", assaultriflecatstr, "Buy", "Back");
  749. }
  750.  
  751. stock ShowSniperRifleCat(playerid)
  752. {
  753.     new sniperriflecatstr[256];
  754.     format(sniperriflecatstr, sizeof(sniperriflecatstr), "Sniper Rifle      $%d", SniperRiflePrice);
  755.     ShowPlayerDialog(playerid, DIALOG_IWSTORE_SNIPERRIFLE, DIALOG_STYLE_LIST, "{E6E6E6}Sniper Rifle", sniperriflecatstr, "Buy", "Back");
  756. }
  757.  
  758. stock ShowShotgunCat(playerid)
  759. {
  760.     new shotguncatstr[256];
  761.     format(shotguncatstr, sizeof(shotguncatstr), "Assault Shotgun       $%d\nPump Shotgun   $%d\nSawed Off Shotgun  $%d", AssaultShotgunPrice, PumpShotgunPrice, SawedOffShotgunPrice);
  762.     ShowPlayerDialog(playerid, DIALOG_IWSTORE_SHOTGUN, DIALOG_STYLE_LIST, "{E6E6E6}Shotgun", shotguncatstr, "Buy", "Back");
  763. }
  764.  
  765. stock ShowHeavyCat(playerid)
  766. {
  767.     new heavycatstr[256];
  768.     format(heavycatstr, sizeof(heavycatstr), "Grenade Launcher      $%d\nMinigun        $%d\nRPG    $%d", GrenadeLauncherPrice, MinigunPrice, RPGPrice);
  769.     ShowPlayerDialog(playerid, DIALOG_IWSTORE_HEAVY, DIALOG_STYLE_LIST, "{E6E6E6}Heavy", heavycatstr, "Buy", "Back");
  770. }
  771.  
  772. stock ShowProjectileCat(playerid)
  773. {
  774.     new projectilecatstr[256];
  775.     format(projectilecatstr, sizeof(projectilecatstr), "Grenade     $%d\nTear Gas       $%d", GrenadePrice, TearGasPrice);
  776.     ShowPlayerDialog(playerid, DIALOG_IWSTORE_PROJECTILE, DIALOG_STYLE_LIST, "{E6E6E6}Projectile", projectilecatstr, "Buy", "Back");
  777. }
  778.  
  779. stock ShowMoneyError(playerid)
  780. {
  781.     return SendClientMessage(playerid, COLOR_DANGER, "You must have enough money to buy this!");
  782. }
Advertisement
Add Comment
Please, Sign In to add comment