Dialog not closing.
#1

Hello. I'm creating a dialog (which i havent done for a while.) and upon pressing "Close" it prompts me to the skin selection menu. How can I make it close the dialog instead of showing the skin dialog? Thank you.

pawn Код:
switch (dialogid)
    {
        case SHOP_DIALOG:
        {
            if(listitem == 0)
            {
                ShowPlayerDialog(playerid, SHOP_SKIN, DIALOG_STYLE_INPUT, "Enter a valid Skin ID.", "Enter Skin ID",  "OK", "Cancel");
            }
            if(listitem == 1) //armour
            {
                SetPlayerArmour(playerid, 50);
                GivePlayerMoney(playerid, -2500);
            }
        }
        case SHOP_SKIN:
        {
            if (response)
            {
                SetPlayerSkin(playerid, strval(inputtext));
                GivePlayerMoney(playerid, -5000);
            }
            return 1;
        }

pawn Код:
CMD:shop(playerid, params[])
{
    new money = GetPlayerMoney(playerid);
    if(GameProgress == 1) return SendClientMessage(playerid,COLOR_GREY, "Error: You can't open the shop when a game is in progress.");
    if(intro[playerid] == 1) return SendClientMessage(playerid,COLOR_GREY, "Error: You can't open the shop in the introduction.");
    if(money < 5000 ) return SendClientMessage(playerid,COLOR_GREY, "Error: You need at least 5,000 to open the shop.");
    {
        ShowPlayerDialog(playerid,SHOP_DIALOG,DIALOG_STYLE_LIST,"Hunger Games Shop", "Buy different skin (5,000$)\nArmour(2,500$)", "Select", "Cancel");
    }
    return 1;
}
Reply
#2

Код:
            if(response)
            {
                SetPlayerSkin(playerid, strval(inputtext));
                GivePlayerMoney(playerid, -5000);
            }
IDK if this would work but using Switch in OnDialogResponse is a terrible idea(In my point of view), I suggest using if(dialogid == 1) { code } this will help u more and keep your code looking pretty, If you want me to do that for you just ask me..
Reply
#3

Had a few people debate about that. Confuses the shit out of me. But I'll try it differently and get back to ya.

EDIT: I modified it and it seems to work. Thanks for assistance.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)