Problem with dialogs
#1

Today, i made gun shop.My fs has 6 dialogs
First dialog-Melee guns
Second dialog-Pistols
Third-Shotguns
....
All works fine, but when i try to buy guns from second or trhird dialog i get melee guns from first dialog, how to fix that ?
Reply
#2

show us code whole
Reply
#3

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == dshop11)
    {
        if(response)
        {

            if(listitem == 0)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 1, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Knuckle Dusters");
            }
            if(listitem == 1)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 2, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Golf Club");
            }
            if(listitem == 2)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 3, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Nite Stick");
            }
            if(listitem == 3)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 4, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Knife");
            }
            if(listitem == 4)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 5, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Baseball Bat");
            }
            if(listitem == 5)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 6, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Shovel");
            }
            if(listitem == 6)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 7, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Pool Cue");
            }
            if(listitem == 7)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 8, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Katana");
            }
            if(listitem == 8)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 10, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Dildo");
            }
        }
        return 1;
    }
    return 0;
      if(dialogid == dshop12)
    {
        if(response)
        {

            if(listitem == 9)
            {
                if(GetPlayerMoney(playerid) <250) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 22, 500);
                GivePlayerMoney(playerid, -250);
                SendClientMessage(playerid,COLOR_RED,"You bought 9mm");
            }
            if(listitem == 10)
            {
                if(GetPlayerMoney(playerid) <300) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 23, 500);
                GivePlayerMoney(playerid, -300);
                SendClientMessage(playerid,COLOR_RED,"You bought Slinced 9mm");
            }
            if(listitem == 11)
            {
                if(GetPlayerMoney(playerid) <1000) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 24, 100);
                GivePlayerMoney(playerid, -1000);
                SendClientMessage(playerid,COLOR_RED,"You bought Desert Eagle");
            }
        }
        return 1;
    }
    return 0;
      }


 public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == shop11)
    {
        ShowPlayerDialog(playerid, dshop11, DIALOG_STYLE_LIST, "Melee weapons", "Knuckle Dusters-100$\nGolf Club-100$\nNite Stick-100$\nKnife-100$\nBat-100$\nShovel-100$\nPool Cue-100$\nKatana-100$\nDildo-100$\n", "Buy", "Cancel");
    }
    if(pickupid == shop12)
    {
        ShowPlayerDialog(playerid, dshop12, DIALOG_STYLE_LIST, "Pistols", "9mm-250$\nSilenced 9mm-300$\nDesert Eagle-1000$", "Buy", "Cancel");
    }
    if(pickupid == shop13)
    {
        ShowPlayerDialog(playerid, dshop13, DIALOG_STYLE_LIST, "Shotguns", "Standard Shotgun-400$\nCombat Shotgun-4000$", "Buy", "Cancel");
    }
    if(pickupid == shop14)
    {
        ShowPlayerDialog(playerid, dshop14, DIALOG_STYLE_LIST, "Sub-Machine Guns", "Uzi-500$\nSMG-550$\nTec9-600$", "Buy", "Cancel");
    }
    if(pickupid == shop15)
    {
        ShowPlayerDialog(playerid, dshop15, DIALOG_STYLE_LIST, "Rifle's", "Country Rifle-500$\nSniper Rifle-3000$", "Buy", "Cancel");
    }
    if(pickupid == shop16)
    {
         ShowPlayerDialog(playerid, dshop16, DIALOG_STYLE_LIST, "Heavy guns", "AK-47-3000$\nM4-3500$", "Buy", "Cancel");
    }
    return 1;
}
Reply
#4

Hmmmm.. try changing the ids of the dialog maybe they are the same or are interfering with another script or GM.
Reply
#5

I tryed and nothing
Reply
#6

Why are you returning 0 after each dialog?
Reply
#7

I tried without this, but its the same
Reply
#8

ok try this one

maybe this should works fine

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == dshop11)
    {
        if(response)
        {
            switch(listitem)
            {
              if(listitem == 0)
               {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 1, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Knuckle Dusters");
            }
            if(listitem == 1)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 2, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Golf Club");
            }
            if(listitem == 2)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 3, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Nite Stick");
            }
            if(listitem == 3)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 4, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Knife");
            }
            if(listitem == 4)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 5, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Baseball Bat");
            }
            if(listitem == 5)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 6, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Shovel");
            }
            if(listitem == 6)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 7, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Pool Cue");
            }
            if(listitem == 7)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 8, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Katana");
            }
            if(listitem == 8)
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 10, 1);
                GivePlayerMoney(playerid, -100);
                SendClientMessage(playerid,COLOR_RED,"You bought Dildo");
            }
        }
    }

   else if(dialogid == dshop12)
    {
        if(response)
        {

            if(listitem == 9)
            {
                if(GetPlayerMoney(playerid) <250) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 22, 500);
                GivePlayerMoney(playerid, -250);
                SendClientMessage(playerid,COLOR_RED,"You bought 9mm");
            }
            if(listitem == 10)
            {
                if(GetPlayerMoney(playerid) <300) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 23, 500);
                GivePlayerMoney(playerid, -300);
                SendClientMessage(playerid,COLOR_RED,"You bought Slinced 9mm");
            }
            if(listitem == 11)
            {
                if(GetPlayerMoney(playerid) <1000) return SendClientMessage(playerid,COLOR_WHITE, "You do not have enough money.");
                GivePlayerWeapon(playerid, 24, 100);
                GivePlayerMoney(playerid, -1000);
                SendClientMessage(playerid,COLOR_RED,"You bought Desert Eagle");
            }
          }
        }
        return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == shop11)
    {
        ShowPlayerDialog(playerid, dshop11, DIALOG_STYLE_LIST, "Melee weapons", "Knuckle Dusters-100$\nGolf Club-100$\nNite Stick-100$\nKnife-100$\nBat-100$\nShovel-100$\nPool Cue-100$\nKatana-100$\nDildo-100$\n", "Buy", "Cancel");
    }
    if(pickupid == shop12)
    {
        ShowPlayerDialog(playerid, dshop12, DIALOG_STYLE_LIST, "Pistols", "9mm-250$\nSilenced 9mm-300$\nDesert Eagle-1000$", "Buy", "Cancel");
    }
    if(pickupid == shop13)
    {
        ShowPlayerDialog(playerid, dshop13, DIALOG_STYLE_LIST, "Shotguns", "Standard Shotgun-400$\nCombat Shotgun-4000$", "Buy", "Cancel");
    }
    if(pickupid == shop14)
    {
        ShowPlayerDialog(playerid, dshop14, DIALOG_STYLE_LIST, "Sub-Machine Guns", "Uzi-500$\nSMG-550$\nTec9-600$", "Buy", "Cancel");
    }
    if(pickupid == shop15)
    {
        ShowPlayerDialog(playerid, dshop15, DIALOG_STYLE_LIST, "Rifle's", "Country Rifle-500$\nSniper Rifle-3000$", "Buy", "Cancel");
    }
    if(pickupid == shop16)
    {
         ShowPlayerDialog(playerid, dshop16, DIALOG_STYLE_LIST, "Heavy guns", "AK-47-3000$\nM4-3500$", "Buy", "Cancel");
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by Namer
Посмотреть сообщение
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == dshop11)
    {
        if(response)
        {
            switch(listitem)
            {
              if(listitem == 0)
               {
                // rest of it
That will never work. Use either switch or if statement, not both together.

Quote:
Originally Posted by bustern
Посмотреть сообщение
Thx you, all works fine my bad was that i made all dialogs to work at one ID
Quote:
Originally Posted by kingofdemons
Посмотреть сообщение
Hmmmm.. try changing the ids of the dialog maybe they are the same or are interfering with another script or GM.
Quote:
Originally Posted by bustern
Посмотреть сообщение
I tryed and nothing
lol ok.
Reply
#10

Thx you, all works fine my bad was that i made all dialogs to work at one ID
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)