Weapon shop
#1

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
Reply
#2

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.
Reply
#3

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.
Reply
#4

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
}
Reply
#5

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

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.
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)