Ws dialog list help
#1

Well basically my problem is that , if you but lets say some tec-9ґs , with 600 ammo (the default one) , and then you buy a different weapon but like same style/category , lets say some Uzis , the ammo gets summed up , it doesnt go to the default uzi ammo.

Lets say you have 600 tec-9 , you buy uzi , and instead of getting 600 uzi , it will go up to 1200 uzi. It sums them up :S

Here are a few pics so you understand me:










And here is the dialog pawno.Is there anything I should define or smthin?

pawn Код:
CMD:ws(playerid, params[])
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Weapons","Desert Eagle ($5000)\nChainsaw ($10000)\nSawnoff Shotgun ($10000)\nMicro SMG/Uzi ($15000)\nTec-9 ($15000)\nMP5 ($17000)\nAK-47 ($17000)\nM4($17000)\nSniper Rifle($18000)\nFull Health($1000)\nFull Armour ($1000)", "Purchase", "Cancel");
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)// They pressed the first button.
    {
    switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        {
                case 1:// Our dialog!
            {
                switch(listitem)// Checking which listitem was selected
                {
                    case 0:// Desert Eagle
                    {
                        if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                        GivePlayerMoney(playerid, -5000);
                        GivePlayerWeapon(playerid, 24, 150);
                    }
                    case 1: // Chainsaw
                    {
                        if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                        GivePlayerMoney(playerid, -10000);
                        GivePlayerWeapon(playerid, 9, 500);
                    }
                    case 2: // Sawns
                    {
                        if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                        GivePlayerMoney(playerid, -10000);
                        GivePlayerWeapon(playerid, 26, 300);
                    }
                    case 3: // Uzi
                    {
                        if(GetPlayerMoney(playerid) < 15000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                        GivePlayerMoney(playerid, -15000);
                        GivePlayerWeapon(playerid, 28, 750);
                    }
                    case 4: // Tec 9
                    {
                        if(GetPlayerMoney(playerid) < 15000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                        GivePlayerMoney(playerid, -15000);
                        GivePlayerWeapon(playerid, 32, 600);
                    }
                    case 5: // MP5
                    {
                        if(GetPlayerMoney(playerid) < 17000 ) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                        GivePlayerMoney(playerid, -17000);
                        GivePlayerWeapon(playerid, 29, 400);
                    }
                    case 6: // ak47
                    {
                        if(GetPlayerMoney(playerid) < 17000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                        GivePlayerMoney(playerid, -17000);
                        GivePlayerWeapon(playerid, 30, 400);
                    }
                    case 7: // m4
                    {
                        if(GetPlayerMoney(playerid) < 17000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                        GivePlayerMoney(playerid, -17000);
                        GivePlayerWeapon(playerid, 31, 400);
                    }
                    case 8: // Sniper
                    {
                        if(GetPlayerMoney(playerid) < 18000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                        GivePlayerMoney(playerid, -18000);
                        GivePlayerWeapon(playerid, 34, 150);
                    }
                    case 9: // Health
                    {
                        if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                        GivePlayerMoney(playerid, -1000);
                        SetPlayerHealth(playerid, 100);
                    }
                    case 10: // Armour
                    {
                        if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                        GivePlayerMoney(playerid, -3);
                        SetPlayerArmour(playerid, 100);
                    }
                }
            }
        }
    }
    return 1;
}
Reply
#2

You must of put the list in the wrong order.
Reply
#3

Quote:
Originally Posted by phillip875
Посмотреть сообщение
You must of put the list in the wrong order.
Nono, like, if you but tec-9ґs with 600 ammo , and when you have that, go on to buy some uzis , you get the uzis, but with tec9 + uzi ammo.
Reply
#4

You have used the wrong weapon id then, easy mistake to make (I've done that once before :O)
Reply
#5

https://sampwiki.blast.hk/wiki/SetPlayerAmmo
Reply
#6

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
But if I use lets say "SetplayerAmmo" , then it means that everytime you buy tec-9 , even if you want more ammo, you will get the same ammo?

Btw it isnt the idґs , since as you can see one is id 32 and the other is 28 or something..

It just sums up slot ammo
Reply
#7

Oh, I get what you mean now.

Wait 2 mins.
Reply
#8

Actually I'm confused, explain more easily please.
Reply
#9

Quote:
Originally Posted by phillip875
Посмотреть сообщение
Actually I'm confused, explain more easily please.
OK.So if you look at the first screenshots, you can see the menu is all set up the way it should.The weapon IDґs are right too , and everything seems to be working ok.

There are some weapons that will replace others when been bought (example chainsaw / cane , tec9/uzi ,sawn off shotgun/combat shotgun) , but the problem is , that when I , for example, but a tec-9 , but then I decide i want a uzi , instead of deleting the tec-9 ammo , it gives me a uzi with the tec9ammo + the default uzi ammo.

So lets say I have 600 tec-9 , then i want to buy some uzis.
When I buy the uzis (in the script, the default ammo is 600) ,I get a uzi with 1200 ammo (600 tec-9 ammo + 600 uzi ammo) , and I dont know how to fix it.

Hope you understood
Reply
#10

Oh, there is nothign you can do about that.

The reason is, some weapons use the same weapon slots which explains why it removes a players previous weapon in that slot.

Hope that made some sense :S

but, you should use:

pawn Код:
SetPlayerAmmo(playerid, WEAPONSLOTID, 0);
Add that above this:

pawn Код:
GivePlayerWeapon(playerid,WEAPONID,ammo);
Before setting another weapon - The slot each weapon uses is in the SA:MP weapon ids list.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)