Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- /*
- Dont forget to make a
- new shop[shopid] if you're adding in more places. If not it'll return an error.
- */
- new shop1;
- new shop2;
- new shop3;
- new shop4;
- new shop5;
- new shop6;
- new shop7;
- new shop8;
- new shop9;
- new shop10;
- new shop11;
- new shop12;
- new shop13;
- new shop14;
- new shop15;
- new shop16;
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" [Shop Filterscript By Dobby Loaded] ");
- print("--------------------------------------\n");
- /*
- Theres different pickup types in sa-mp. More info can be found on sa-mp wiki.
- For this, i used Type 2: Respawns after an amount of time.
- Because its a shop, i thought it be right to use the pickup type: 1274 which is a $ sign (dollar)
- */
- shop1 = CreatePickup(1274, 2, 2117.4395, 897.6519, 11.1797, -1);
- shop2 = CreatePickup(1274, 2, 2193.9907, 1991.0746,12.2969, -1);
- shop3 = CreatePickup(1274, 2, 2150.6089, 2735.5225,11.1763, -1);
- shop4 = CreatePickup(1274, 2, 1165.4901, 1343.9807, 10.8125, -1);
- shop5 = CreatePickup(1274, 2, 1557.5317, 944.3329, 10.8125, -1);
- shop6 = CreatePickup(1274, 2, 251.8371, -56.8218, 1.5703, -1);
- shop7 = CreatePickup(1274, 2, 660.7606,-573.5315,16.3359, -1);
- shop8 = CreatePickup(1274, 2, 1311.4441,329.3672,19.9141, -1);
- shop9 = CreatePickup(1274, 2, 2302.4375,-16.1539,26.4844, -1);
- shop10 = CreatePickup(1274, 2, 2423.9441,-1742.5582,13.5424, -1);
- shop11 = CreatePickup(1274, 2, 1930.1350,-1776.0450,13.5469, -1);
- shop12 = CreatePickup(1274, 2, 1833.0823,-1842.4578,13.5781, -1);
- shop13 = CreatePickup(1274, 2, 1565.8511,-1170.9038,24.0914, -1);
- shop14 = CreatePickup(1274, 2, 2140.4976,-1176.8151,23.9922, -1);
- shop15 = CreatePickup(1274, 2, -2032.1327,161.0344,29.0461, -1);
- shop16 = CreatePickup(1274, 2, 2029.4854,-121.4458,35.1797, -1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- #endif
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- /*
- Here the dialog responses are set to appear when the player picks up the pickup, hence the public function.
- If you choose to add more items in. Remember to update here, after the case part. Otherwise, it won't show.
- I've also listed the price along with the item. Purely so people can see the price of things.
- the "\n" part adds a new line so hello\nSamp\nforums will show on the dialog as
- Hello
- Samp
- Forums
- You can find out more about dialog types on the sa-mp wiki
- */
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- 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.
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop2)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop3)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop4)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop5)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop6)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop7)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop8)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop9)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop10)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop11)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop12)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop13)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop14)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop15)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- if(pickupid == shop16)
- ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_LIST, "Shop", "Health - $1000\nSpray - $1000\nBike - $3000\nDido - $5000\nDeath - For you. It's free", "Buy", "Close");
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 7777) // as mentioned above. Dialogs make each dialog type unique. Each new dialog, has to have a new ID
- {
- if(!response)
- return 1;
- 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
- {
- case 0:
- {
- if(GetPlayerMoney(playerid) < 1000)
- return SendClientMessage(playerid, 0, "You do not have enough cash");
- GivePlayerMoney(playerid, -1000);
- SetPlayerHealth(playerid,100);
- }
- case 1:
- {
- if(GetPlayerMoney(playerid) <1000)
- return SendClientMessage(playerid,-1, "You do not have enough cash");
- GivePlayerMoney(playerid, -1000);
- GivePlayerWeapon(playerid, 41,1000);
- }
- case 2:
- {
- if (GetPlayerMoney(playerid) <3000)
- return SendClientMessage(playerid,-1,"You do not have enough cash");
- GivePlayerMoney(playerid, -3000);
- new Float:p[4];
- GetPlayerPos(playerid, p[0], p[1], p[2]); // this creates a vehicle (being the bike) at the players position.
- GetPlayerFacingAngle(playerid, p[3]);
- CreateVehicle(510, p[0], p[1], p[2], p[3]+90, -1, -1, 9999999);
- }
- case 3:
- {
- if (GetPlayerMoney(playerid) <5000) // checks if the player has enough cash.
- return SendClientMessage(playerid,-1,"You do not have enough cash"); //tells the player they dont have enough
- GivePlayerMoney(playerid, -5000); //takes the money
- GivePlayerWeapon(playerid, 10, 1); // gives the player the weapon
- }
- case 4:
- {
- if (GetPlayerMoney(playerid) <0)
- return SendClientMessage(playerid, -1, "Unlucky. Too poor to die!");
- SetPlayerHealth(playerid,0);
- SendClientMessage(playerid,-1,"Aww you died.");
- }
- /* add more here if you want to. Remember to update the case number, and the OnPlayerPickupPickupFunction.
- EG Case 5:
- {
- if GetPlayerMoney(playerid <pricehere) just checks if the player has enough money.
- if they dont, it returns SendClientMessage as seen above
- for more things to do when a player picks something, check out sa-mp wiki
- */
- }
- }
- return 1;
- }/*
- 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.
- Remember to give me credit ;)
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement