ExtendedCarbon

WeaponShop

Sep 25th, 2014
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.72 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4.  
  5. //prices, just change the number to set the price of the weapon. The dialogs will be auto updated
  6. new colt = 150;
  7. new deagle = 300;
  8. new pumpshotgun = 350;
  9. new combatshotgun = 500;
  10. new mp5 = 420;
  11. new tec9 = 400;
  12. new ak47 = 700;
  13. new m4 = 700;
  14. new sniper = 1000;
  15. new countryrifle = 850;
  16. new armour = 500;
  17. new parachute = 210;
  18.  
  19. public OnFilterScriptInit()
  20. {
  21.     print("\n--------------------------------------");
  22.     print("         WeaponShop by Pawnify         ");
  23.     print("--------------------------------------\n");
  24.     return 1;
  25. }main();
  26.  
  27. CMD:shop(playerid, params[])
  28. {
  29.     if(!IsPlayerInAnyVehicle(playerid))
  30.     {
  31.         ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop","{96BBD9}Pistols\n{518FC2}Shotguns\n{96BBD9}Submachine guns\n{518FC2}Assault Rifles\n{96BBD9}Snipers\n{518FC2}Extras","Proceed","Cancel");
  32.     }else SendClientMessage(playerid, -1, "{FFFF00}[ERROR] {808080}You cannot use this command inside of a vehicle.");
  33.     return 1;
  34. }
  35.  
  36. CMD:buy(playerid, params[])
  37. {
  38.     return cmd_shop(playerid, params);
  39. }
  40.  
  41. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  42. {
  43.     new buylist1[100],buylist2[100],buylist3[100],buylist4[100],buylist5[100],buylist6[100];
  44.     format(buylist1,sizeof(buylist1),"Colt-45 {4ECC47}[$%i]\nDesert Eagle {4ECC47}[$%i]",colt,deagle);
  45.     format(buylist2,sizeof(buylist2),"Pump Shotgun {4ECC47}[$%i]\nCombat Shotgun {4ECC47}[$%i]",pumpshotgun,combatshotgun);
  46.     format(buylist3,sizeof(buylist3),"MP5 {4ECC47}[$%i]\nTec-9 {4ECC47}[$%i]",mp5,tec9);
  47.     format(buylist4,sizeof(buylist4),"AK47 {4ECC47}[$%i]\nM4 {4ECC47}[$%i]",ak47,m4);
  48.     format(buylist5,sizeof(buylist5),"Sniper Rifle {4ECC47}[$%i]\nCountry Rifle {4ECC47}[$%i]",sniper,countryrifle);
  49.     format(buylist6,sizeof(buylist6),"Armour {4ECC47}[$%i]\nParachute {4ECC47}[$%i]",armour,parachute);
  50.     if(dialogid == 0)
  51.     {
  52.         if(response)
  53.         {
  54.             switch(listitem)
  55.             {
  56.                 case 0: ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop - Pistols",buylist1,"Buy","");
  57.                 case 1: ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop - Shotguns",buylist2,"Buy","");
  58.                 case 2: ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop - Submachine gun",buylist3,"Buy","");
  59.                 case 3: ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop - Assault",buylist4,"Buy","");
  60.                 case 4: ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop - Rifles",buylist5,"Buy","");
  61.                 case 5: ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop - Extras",buylist6,"Buy","");
  62.             }
  63.         }
  64.     }
  65.     if(dialogid == 1)
  66.     {
  67.         if(response)
  68.         {
  69.             switch(listitem)
  70.             {
  71.                 case 0:
  72.                 {
  73.                     if(GetPlayerMoney(playerid) >= colt)
  74.                     {
  75.                         GivePlayerMoney(playerid, -colt);
  76.                         GivePlayerWeapon(playerid, WEAPON_COLT45, 99999);
  77.                     }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money.");
  78.                 }
  79.                 case 1:
  80.                 {
  81.                     if(GetPlayerMoney(playerid) >= deagle)
  82.                     {
  83.                         GivePlayerMoney(playerid, -deagle);
  84.                         GivePlayerWeapon(playerid, WEAPON_DEAGLE, 99999);
  85.                     }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money.");
  86.                 }
  87.             }
  88.         }
  89.     }
  90.     if(dialogid == 2)
  91.     {
  92.         if(response)
  93.         {
  94.             switch(listitem)
  95.             {
  96.                 case 0:
  97.                 {
  98.                     if(GetPlayerMoney(playerid) >= pumpshotgun)
  99.                     {
  100.                         GivePlayerMoney(playerid, -pumpshotgun);
  101.                         GivePlayerWeapon(playerid, WEAPON_SHOTGUN, 99999);
  102.                     }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money.");
  103.                 }
  104.                 case 1:
  105.                 {
  106.                     if(GetPlayerMoney(playerid) >= combatshotgun)
  107.                     {
  108.                         GivePlayerMoney(playerid, -combatshotgun);
  109.                         GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 99999);
  110.                     }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money.");
  111.                 }
  112.             }
  113.         }
  114.     }
  115.     if(dialogid == 3)
  116.     {
  117.         if(response)
  118.         {
  119.             switch(listitem)
  120.             {
  121.                 case 0:
  122.                 {
  123.                     if(GetPlayerMoney(playerid) >= mp5)
  124.                     {
  125.                         GivePlayerMoney(playerid, -mp5);
  126.                         GivePlayerWeapon(playerid, WEAPON_MP5, 99999);
  127.                     }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money.");
  128.                 }
  129.                 case 1:
  130.                 {
  131.                     if(GetPlayerMoney(playerid) >= tec9)
  132.                     {
  133.                         GivePlayerMoney(playerid, -tec9);
  134.                         GivePlayerWeapon(playerid, WEAPON_TEC9, 99999);
  135.                     }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money.");
  136.                 }
  137.             }
  138.         }
  139.     }
  140.     if(dialogid == 4)
  141.     {
  142.         if(response)
  143.         {
  144.             switch(listitem)
  145.             {
  146.                 case 0:
  147.                 {
  148.                     if(GetPlayerMoney(playerid) >= ak47)
  149.                     {
  150.                         GivePlayerMoney(playerid, -ak47);
  151.                         GivePlayerWeapon(playerid, WEAPON_AK47, 99999);
  152.                     }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money.");
  153.                 }
  154.                 case 1:
  155.                 {
  156.                     if(GetPlayerMoney(playerid) >= m4)
  157.                     {
  158.                         GivePlayerMoney(playerid, -m4);
  159.                         GivePlayerWeapon(playerid, WEAPON_M4, 99999);
  160.                     }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money.");
  161.                 }
  162.             }
  163.         }
  164.     }
  165.     if(dialogid == 5)
  166.     {
  167.         if(response)
  168.         {
  169.             switch(listitem)
  170.             {
  171.                 case 0:
  172.                 {
  173.                     if(GetPlayerMoney(playerid) >= sniper)
  174.                     {
  175.                         GivePlayerMoney(playerid, -sniper);
  176.                         GivePlayerWeapon(playerid, WEAPON_SNIPER, 99999);
  177.                     }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money.");
  178.                 }
  179.                 case 1:
  180.                 {
  181.                     if(GetPlayerMoney(playerid) >= countryrifle)
  182.                     {
  183.                         GivePlayerMoney(playerid, -countryrifle);
  184.                         GivePlayerWeapon(playerid, WEAPON_RIFLE, 99999);
  185.                     }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money.");
  186.                 }
  187.             }
  188.         }
  189.     }
  190.     if(dialogid == 6)
  191.     {
  192.         if(response)
  193.         {
  194.             switch(listitem)
  195.             {
  196.                 case 0:
  197.                 {
  198.                     if(GetPlayerMoney(playerid) >= armour)
  199.                     {
  200.                         GivePlayerMoney(playerid, -armour);
  201.                         SetPlayerArmour(playerid, 100);
  202.                     }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money.");
  203.                 }
  204.                 case 1:
  205.                 {
  206.                     if(GetPlayerMoney(playerid) >= parachute)
  207.                     {
  208.                         GivePlayerMoney(playerid, -parachute);
  209.                         GivePlayerWeapon(playerid, WEAPON_PARACHUTE, 1);
  210.                     }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money.");
  211.                 }
  212.             }
  213.         }
  214.     }
  215.     return 1;
  216. }
Advertisement
Add Comment
Please, Sign In to add comment