Advertisement
Guest User

Shop Filterscript - Dobby

a guest
Apr 15th, 2013
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.26 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4. /*
  5. Dont forget to make a
  6. new shop[shopid] if you're adding in more places. If not it'll return an error.
  7. */
  8. new shop1;
  9. new shop2;
  10. new shop3;
  11. new shop4;
  12. new shop5;
  13. new shop6;
  14. new shop7;
  15. new shop8;
  16. new shop9;
  17. new shop10;
  18. new shop11;
  19. new shop12;
  20. new shop13;
  21. new shop14;
  22. new shop15;
  23. new shop16;
  24. #if defined FILTERSCRIPT
  25.  
  26. public OnFilterScriptInit()
  27. {
  28.     print("\n--------------------------------------");
  29.     print("  [Shop Filterscript By Dobby Loaded]   ");
  30.     print("--------------------------------------\n");
  31.     /*
  32.     Theres different pickup types in sa-mp. More info can be found on sa-mp wiki.
  33.     For this, i used Type 2: Respawns after an amount of time.
  34.     Because its a shop, i thought it be right to use the pickup type: 1274 which is a $ sign (dollar)
  35.     */
  36.     shop1 = CreatePickup(1274, 2, 2117.4395, 897.6519, 11.1797, -1);
  37.     shop2 = CreatePickup(1274, 2, 2193.9907, 1991.0746,12.2969, -1);
  38.     shop3 = CreatePickup(1274, 2, 2150.6089, 2735.5225,11.1763, -1);
  39.     shop4 = CreatePickup(1274, 2, 1165.4901, 1343.9807, 10.8125, -1);
  40.     shop5 = CreatePickup(1274, 2, 1557.5317, 944.3329,  10.8125, -1);
  41.     shop6 = CreatePickup(1274, 2, 251.8371,  -56.8218, 1.5703, -1);
  42.     shop7 = CreatePickup(1274, 2, 660.7606,-573.5315,16.3359, -1);
  43.     shop8 = CreatePickup(1274, 2, 1311.4441,329.3672,19.9141, -1);
  44.     shop9 = CreatePickup(1274, 2, 2302.4375,-16.1539,26.4844, -1);
  45.     shop10 = CreatePickup(1274, 2, 2423.9441,-1742.5582,13.5424, -1);
  46.     shop11 = CreatePickup(1274, 2, 1930.1350,-1776.0450,13.5469, -1);
  47.     shop12 = CreatePickup(1274, 2, 1833.0823,-1842.4578,13.5781, -1);
  48.     shop13 = CreatePickup(1274, 2, 1565.8511,-1170.9038,24.0914, -1);
  49.     shop14 = CreatePickup(1274, 2, 2140.4976,-1176.8151,23.9922, -1);
  50.     shop15 = CreatePickup(1274, 2, -2032.1327,161.0344,29.0461, -1);
  51.     shop16 = CreatePickup(1274, 2, 2029.4854,-121.4458,35.1797, -1);
  52.     return 1;
  53. }
  54.  
  55. public OnFilterScriptExit()
  56. {
  57.     return 1;
  58. }
  59.  
  60. #else
  61.  
  62. main()
  63. {
  64.     print("\n----------------------------------");
  65.     print(" Blank Gamemode by your name here");
  66.     print("----------------------------------\n");
  67. }
  68.  
  69. #endif
  70. public OnPlayerConnect(playerid)
  71. {
  72.     return 1;
  73. }
  74. /*
  75. Here the dialog responses are set to appear when the player picks up the pickup, hence the public function.
  76. If you choose to add more items in. Remember to update here, after the case part. Otherwise, it won't show.
  77. I've also listed the price along with the item. Purely so people can see the price of things.
  78. the "\n" part adds a new line so hello\nSamp\nforums will show on the dialog as
  79. Hello
  80. Samp
  81. Forums
  82. You can find out more about dialog types on the sa-mp wiki
  83. */
  84. public OnPlayerPickUpPickup(playerid, pickupid)
  85. {
  86.     if(pickupid == shop1)     //7777 is the dialog ID. This is set so each dialog is "uniqe" and the dialogs won't conflict. Ive set it high so it doesn't do so on your gamemode.
  87.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  88.     if(pickupid == shop2)
  89.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  90.     if(pickupid == shop3)
  91.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  92.     if(pickupid == shop4)
  93.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  94.     if(pickupid == shop5)
  95.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  96.     if(pickupid == shop6)
  97.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  98.     if(pickupid == shop7)
  99.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  100.     if(pickupid == shop8)
  101.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  102.     if(pickupid == shop9)
  103.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  104.     if(pickupid == shop10)
  105.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  106.     if(pickupid == shop11)
  107.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  108.     if(pickupid == shop12)
  109.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  110.     if(pickupid == shop13)
  111.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  112.     if(pickupid == shop14)
  113.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  114.     if(pickupid == shop15)
  115.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  116.     if(pickupid == shop16)
  117.     ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
  118.     return 1;
  119. }
  120. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  121. {
  122.     if(dialogid == 7777) // as mentioned above. Dialogs make each dialog type unique. Each new dialog, has to have a new ID
  123.     {
  124.         if(!response)
  125.             return 1;
  126.         switch(listitem) // heres the case number for the dialogs in the shop. remember to update here so each case matches dialog. EG: bike will give you a bike and not a spraycan
  127.         {
  128.             case 0:
  129.             {
  130.                 if(GetPlayerMoney(playerid) < 1000)
  131.                     return SendClientMessage(playerid, 0, "You do not have enough cash");
  132.                 GivePlayerMoney(playerid, -1000);
  133.                 SetPlayerHealth(playerid,100);
  134.             }
  135.             case 1:
  136.             {
  137.                 if(GetPlayerMoney(playerid) <1000)
  138.                     return SendClientMessage(playerid,-1, "You do not have enough cash");
  139.                 GivePlayerMoney(playerid, -1000);
  140.                 GivePlayerWeapon(playerid, 41,1000);
  141.             }
  142.             case 2:
  143.             {
  144.                 if (GetPlayerMoney(playerid) <3000)
  145.                     return SendClientMessage(playerid,-1,"You do not have enough cash");
  146.                 GivePlayerMoney(playerid, -3000);
  147.                 new Float:p[4];
  148.                 GetPlayerPos(playerid, p[0], p[1], p[2]); // this creates a vehicle (being the bike) at the players position.
  149.                 GetPlayerFacingAngle(playerid, p[3]);
  150.                 CreateVehicle(510, p[0], p[1], p[2], p[3]+90, -1, -1, 9999999);
  151.             }
  152.             case 3:
  153.             {
  154.                 if (GetPlayerMoney(playerid) <5000) // checks if the player has enough cash.
  155.                    return SendClientMessage(playerid,-1,"You do not have enough cash"); //tells the player they dont have enough
  156.                 GivePlayerMoney(playerid, -5000); //takes the money
  157.                 GivePlayerWeapon(playerid, 10, 1); // gives the player the weapon
  158.             }
  159.             case 4:
  160.             {
  161.                 if (GetPlayerMoney(playerid) <0)
  162.                     return SendClientMessage(playerid, -1, "Unlucky. Too poor to die!");
  163.                 SetPlayerHealth(playerid,0);
  164.                 SendClientMessage(playerid,-1,"Aww you died.");
  165.             }
  166.  
  167.             /* add more here if you want to. Remember to update the case number, and the OnPlayerPickupPickupFunction.
  168.             EG Case 5:
  169.             {
  170.                 if GetPlayerMoney(playerid <pricehere) just checks if the player has enough money.
  171.                 if they dont, it returns SendClientMessage as seen above
  172.                 for more things to do when a player picks something, check out sa-mp wiki
  173.             */
  174.            
  175.         }
  176.     }
  177.     return 1;
  178. }/*
  179. Hopefully you've understood what i've done here by the amount of commenting i've done. If you want any help feel free to ask.
  180. Remember to give me credit ;)
  181. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement