SA-MP Forums Archive
Weapon shop - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Weapon shop (/showthread.php?tid=236017)



Weapon shop - ZaaRawwR - 06.03.2011

Ok, this is impossible to do on my own (I suck at scripting)..
But when someone types in /shop, I want it to open the next time they spawn(Next death, basically). And I want it to say "Going to shop after death!" <--- I know how to do that part.. xD
And then after they die, it opens a box with a list of all buyable weapons, with prices next to them.. And I want the weapons to only give a certain amount of bullets at a time, not infinite. And once they die, they lose the weapons.
Could someone tell/show me how to make one? <3


Re: Weapon shop - Max_Coldheart - 06.03.2011

Yes you can.

first the id of the DIALOG_STYLE_LIST
pawn Code:
#define DIALOG_SHOP 1
then we make the cmd itself ( I use ZCMD here )
pawn Code:
CMD:shop(playerid, params[])
{
        SendClientMessage(playerid, 0xFFFFFFFF, "Going To Shop After Death");
}
and under

pawn Code:
OnPlayerSpawn(playerid)
add
pawn Code:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Shop", "MP5($6000)\nRifle($10000)\nDeagle($5000)","Buy", "Cancel");
Then we go to
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
there add:
pawn Code:
if(dialogid == 1)
    {
        switch(listitem)
        {
            case 0://MP5
            {
                GivePlayerWeapon(playerid, 29, 300);
                GivePlayerMoney(playerid, -6000);
                SendClientMessage(playerid, 0xFFFFFFFF, "You have bought an mp5 for $6000");
            }
            case 1://Rifle
            {
                GivePlayerWeapon(playerid, 33, 20);
                GivePlayerMoney(playerid, -10000);
                SendClientMessage(playerid, 0xFFFFFFFF, "You have bought an rifle for $10000");
            }
            case 2://Deagle
            {
                GivePlayerWeapon(playerid, 24, 100);
                GivePlayerMoney(playerid, -5000);
                SendClientMessage(playerid, 0xFFFFFFFF, "You have bought an deagle for $5000");
            }
        }
    }
It should work.


Re: Weapon shop - ZaaRawwR - 07.03.2011

This doesn't work bro.. I want a weapon shop AFTER death (After they did /shop).. Not on every spawn.. And I don't want the /shop command just to say "Going to shop after death," I want it to actually bring them to it after death (ONLY ONCE).

I need a completely new shop script, the one you made doesn't compile errors, but it doesn't do shit IG.


Re: Weapon shop - Steven82 - 07.03.2011

pawn Code:
new died[MAX_PLAYERS];
now add that at the top of your script.

Now on the shop command do (died[playerid] = 1; )

Now on player spawn do

pawn Code:
if(died[playerid] == 1)
{
 // your code here
}



Re: Weapon shop - ZaaRawwR - 07.03.2011

That doesn't do shit either...
Could someone else help me with this?


Re: Weapon shop - Haydz - 07.03.2011

Try this, note: you will need to have the ZCMD include at the top of the script.
pawn Code:
new NeedsShop[MAX_PLAYERS]; //at the top of the script.

COMMAND:shop(playerid,params[])
{
    NeedsShop[playerid] = 1;
    SendClientMessage(playerid, 0xFFFF,"Going to shop after next death");
    return 1;
}
public OnPlayerSpawn(playerid)
{
    if(NeedsShop[playerid] == 1)
    {
        //showweapondialog here
        NeedsShop[playerid] = 0;
    }
    //other spawn stuff here.
}