Dialog Response
#1

Hello, I am wondering why this is not working:
pawn Код:
if(dialogid == DIALOGID_BS)
    {
        for(new i = 0; i<MAX_BUSINESSES;i++)
        {
            if(response)
            {
                if(IsPlayerInRangeOfPoint(playerid,25,BusinessInfo[i][bEntranceX],BusinessInfo[i][bEntranceY],BusinessInfo[i][bEntranceZ]))
                {
                    new amount = strval(inputtext);
                    if(amount > 0 && amount < 15000)
                    {
                        BusinessInfo[i][bFee][0] = amount;
                        GameTextForPlayer(playerid,"~g~Price has been changed",3000,4);
                        break;
                    }
                }
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOGID_BUSINESSPRICES, DIALOG_STYLE_LIST, "Business Menu", BItems(i), "Edit", "Back");
            }
        }
    }
    if(dialogid == DIALOGID_BS1)
    {
        for(new i = 0; i<MAX_BUSINESSES;i++)
        {
            if(response)
            {
                if(IsPlayerInRangeOfPoint(playerid,25,BusinessInfo[i][bEntranceX],BusinessInfo[i][bEntranceY],BusinessInfo[i][bEntranceZ]))
                {
                    new amount = strval(inputtext);
                    if(amount > 0 && amount < 15000)
                    {
                        BusinessInfo[i][bFee][1] = amount;
                        GameTextForPlayer(playerid,"~g~Price has been changed",3000,4);
                        break;
                    }
                }
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOGID_BUSINESSPRICES, DIALOG_STYLE_LIST, "Business Menu", BItems(i), "Edit", "Back");
            }
        }
    }
    if(dialogid == DIALOGID_BS2)
    {
        for(new i = 0; i<MAX_BUSINESSES;i++)
        {
            if(response)
            {
                if(IsPlayerInRangeOfPoint(playerid,25,BusinessInfo[i][bEntranceX],BusinessInfo[i][bEntranceY],BusinessInfo[i][bEntranceZ]))
                {
                    new amount = strval(inputtext);
                    if(amount > 0 && amount < 15000)
                    {
                        BusinessInfo[i][bFee][2] = amount;
                        GameTextForPlayer(playerid,"~g~Price has been changed",3000,4);
                        break;
                    }
                }
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOGID_BUSINESSPRICES, DIALOG_STYLE_LIST, "Business Menu", BItems(i), "Edit", "Back");
            }
        }
    }
When the player goes and that dialog comes up and they respond, the variable doesn't get set...
Reply
#2

ShowPlayerDialog(playerid, DIALOGID_BUSINESSPRICES, DIALOG_STYLE_LIST, "Business Menu", BItems(i), "Edit", "Back");

DIALOGID_BUSINESSPRICES. Looks like you're messing up with the dialog ID's. The only "id's" I can notice on your code are: DIALOGID_BS, DIALOGID_BS1, DIALOGID_BS2. Check this up. I hope this works.
Reply
#3

That is another dialog that it shows if they don't respond to the current dialog, so it's not that.
Reply
#4

pawn Код:
if(dialogid == DIALOGID_BS)
    {
        for(new i = 0; i<MAX_BUSINESSES;i++)
        {
            if(response)
            {
                if(IsPlayerInRangeOfPoint(playerid,25,BusinessInfo[i][bEntranceX],BusinessInfo[i][bEntranceY],BusinessInfo[i][bEntranceZ]))
                {
                    new amount = strval(inputtext);
                    if(amount > 0 && amount < 15000)
                    {
                        BusinessInfo[i][bFee][0] = amount;
                        GameTextForPlayer(playerid,"~g~Price has been changed",3000,4);
                        break;
                    }
                }
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOGID_BUSINESSPRICES, DIALOG_STYLE_LIST, "Business Menu", BItems(i), "Edit", "Back");
            }
        }
        return 1;
    }
    if(dialogid == DIALOGID_BS1)
    {
        for(new i = 0; i<MAX_BUSINESSES;i++)
        {
            if(response)
            {
                if(IsPlayerInRangeOfPoint(playerid,25,BusinessInfo[i][bEntranceX],BusinessInfo[i][bEntranceY],BusinessInfo[i][bEntranceZ]))
                {
                    new amount = strval(inputtext);
                    if(amount > 0 && amount < 15000)
                    {
                        BusinessInfo[i][bFee][1] = amount;
                        GameTextForPlayer(playerid,"~g~Price has been changed",3000,4);
                        break;
                    }
                }
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOGID_BUSINESSPRICES, DIALOG_STYLE_LIST, "Business Menu", BItems(i), "Edit", "Back");
            }
        }
        return 1;
    }
    if(dialogid == DIALOGID_BS2)
    {
        for(new i = 0; i<MAX_BUSINESSES;i++)
        {
            if(response)
            {
                if(IsPlayerInRangeOfPoint(playerid,25,BusinessInfo[i][bEntranceX],BusinessInfo[i][bEntranceY],BusinessInfo[i][bEntranceZ]))
                {
                    new amount = strval(inputtext);
                    if(amount > 0 && amount < 15000)
                    {
                        BusinessInfo[i][bFee][2] = amount;
                        GameTextForPlayer(playerid,"~g~Price has been changed",3000,4);
                        break;
                    }
                }
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOGID_BUSINESSPRICES, DIALOG_STYLE_LIST, "Business Menu", BItems(i), "Edit", "Back");
            }
        }
        return 1;
    }
    return 0;
You have to return 1; after you've handled every dialog, and then return 0; at the end. That could be the problem, though I don't know.
Reply
#5

I doubt that's the problem, but won't hurt to try it.

Yep it isn't that either, I am really not sure why it isn't setting the variable, anyone know?
Reply
#6

Make sure that's under OnDialogResponse.
Reply
#7

Bump, anyone have a idea what is wrong with the dialog?
Reply
#8

The problem is obviously because this code isn't being ran.
pawn Код:
if(amount > 0 && amount < 15000)
{
    BusinessInfo[i][bFee][0] = amount;
    GameTextForPlayer(playerid,"~g~Price has been changed",3000,4);
    break;
}
Also, it doesn't make sense to loop through everything, and then check if response is true.
pawn Код:
if(response)
{
    for(new i = 0; i<MAX_BUSINESSES;i++) {
        if(IsPlayerInRangeOfPoint(playerid,25,BusinessInfo[i][bEntranceX],BusinessInfo[i][bEntranceY],BusinessInfo[i][bEntranceZ]))
        {
            new amount = strval(inputtext);
            if(amount > 0 && amount < 15000)
            {
                BusinessInfo[i][bFee][0] = amount;
                GameTextForPlayer(playerid,"~g~Price has been changed",3000,4);
                break;
            }
        }
    }
}
else
{
    ShowPlayerDialog(playerid, DIALOGID_BUSINESSPRICES, DIALOG_STYLE_LIST, "Business Menu", BItems(i), "Edit", "Back");
}
There could be a lot of things wrong, and you can easily fix this if you learn to debug. Perhaps the businesses' locations aren't even being loaded.
Reply
#9

What? The business locations are being loaded as you can enter and exit fine. I looped through before checking the response because I needed it for the else statement, but you're right i'll remove that, but other then that it still isn't working, anyone else?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)