Wep Shop mistake?
#1

I am just wondering why my ak-47 weapon isnt showing up when im in game, i have everything showing but that in my dialog shown, this is a very simple mistake i am making im sure. I have had maybe a bit too much to drink here and i keep messing something up over and over...what am i doing wrong people? lol

You may delete this post after my problem is resolved as im sure its such a simple one....

if (dialogid == 20320 && response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, 20321, DIALOG_STYLE_LIST, "Weapon Shop", "9mm($100)\nSilenced 9mm($100)\nMP5($500)\nShotgun($500)\nGrenades($500 )\nAK-47($800)", "Buy", "Exit");
}
}
}
if (dialogid == 20321 && response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You dont have enough money to buy a 9mm!");
GivePlayerWeapon(playerid, 22,100);
GivePlayerMoney(playerid, -100);
SendClientMessage(playerid, 0xFFFFFFFF, "You have bought a 9mm with 100 rounds");
}
case 1:
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You dont have enough money to buy a Silenced 9mm!");
GivePlayerWeapon(playerid, 23,100);
GivePlayerMoney(playerid, -100);
SendClientMessage(playerid, 0xFFFFFFFF, "You have bought a Silenced 9mm with 100 rounds");
}
case 2:
{
if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You dont have enough money to buy a MP5!");
GivePlayerWeapon(playerid, 29,100);
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, 0xFFFFFFFF, "You have bought a MP5 with 100 rounds");
}
case 3:
{
if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You dont have enough money to buy a Shotgun!");
GivePlayerWeapon(playerid, 25,50);
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, 0xFFFFFFFF, "You have bought a Shotgun with 50 rounds");
}
case 4:
{
if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You dont have enough money to buy Grenades!");
GivePlayerWeapon(playerid, 16,50);
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, 0xFFFFFFFF, "You have bought 50 Grenades");
}
case 5:
{
if(GetPlayerMoney(playerid) < 800) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You dont have enough money to buy a AK-47!");
GivePlayerWeapon(playerid, 30,100);
GivePlayerMoney(playerid, -800);
SendClientMessage(playerid, 0xFFFFFFFF, "You have bought a AK-47 with 100 rounds");
}
}
}
return 1;
}
Reply
#2

I don't really see anything wrong with code, unless I misunderstood what you meant. You buy an AK-47 using the dialog but it doesn't work and doesn't appear, right?

Btw, I would suggest structuring your code properly:
pawn Код:
if (dialogid == 20320 && response)
    {
        switch(listitem)
        {
            case 0: ShowPlayerDialog(playerid, 20321, DIALOG_STYLE_LIST, "Weapon Shop", "9mm($100)\nSilenced 9mm($100)\nMP5($500)\nShotgun($500)\nGrenades($500)\nAK-47($800)", "Buy", "Exit");
        }
    }
    else if (dialogid == 20321 && response)
    {
        switch(listitem)
        {
            case 0:
            {
                if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You dont have enough money to buy a 9mm!");

                GivePlayerWeapon(playerid, 22, 100);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid, 0xFFFFFFFF, "You have bought a 9mm with 100 rounds");
            }
            case 1:
            {
                if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You dont have enough money to buy a Silenced 9mm!");

                GivePlayerWeapon(playerid, 23, 100);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid, 0xFFFFFFFF, "You have bought a Silenced 9mm with 100 rounds");
            }
            case 2:
            {
                if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You dont have enough money to buy a MP5!");

                GivePlayerWeapon(playerid, 29, 100);
                GivePlayerMoney(playerid, -500);
                SendClientMessage(playerid, 0xFFFFFFFF, "You have bought a MP5 with 100 rounds");
            }
            case 3:
            {
                if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You dont have enough money to buy a Shotgun!");

                GivePlayerWeapon(playerid, 25, 50);
                GivePlayerMoney(playerid, -500);
                SendClientMessage(playerid, 0xFFFFFFFF, "You have bought a Shotgun with 50 rounds");
            }
            case 4:
            {
                if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You dont have enough money to buy Grenades!");

                GivePlayerWeapon(playerid, 16, 50);
                GivePlayerMoney(playerid, -500);
                SendClientMessage(playerid, 0xFFFFFFFF, "You have bought 50 Grenades");
            }
            case 5:
            {
                if(GetPlayerMoney(playerid) < 800) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You dont have enough money to buy a AK-47!");

                GivePlayerWeapon(playerid, 30, 100);
                GivePlayerMoney(playerid, -800);
                SendClientMessage(playerid, 0xFFFFFFFF, "You have bought a AK-47 with 100 rounds");
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)