Dialogs
#1

Dialogs with submenus arent working for me. The dialog shows, but then when i double click an option it just disappears and no other menu shows up. Can someone help me?
Reply
#2

first make somewhere the dialog, as you have done (I think xD)
Like this:
pawn Код:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Something", "Option 1\r\nOption 2", "OK", "Cancel");
Then, you need this: (OnDialogResponse)

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0: ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Sub Option 1", "Option 1\r\nOption 2", "OK", "Cancel");
                case 1: ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Sub Option 2", "Option 1\r\nOption 2", "OK", "Cancel");
            }
        }
    }
    if(dialogid == 2) //Sub option 1
    {
        //Do something
    }
    if(dialogid == 3) //sub option 2
    {
        //Do something
    }
    return 1;
}
Reply
#3

Yea, when I click option 2 on the first dialog, nothing happens. The first dialog with the title "Something" shows up though. I told it to SendClientMessage, but it didnt.
Reply
#4

This is my problem:
[ame]http://www.youtube.com/watch?v=Qby6UfPZUEk[/ame]

Source:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/drinks", true))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Sprunk ($1)\nBeer ($2)\nWine ($3)", "Purchase", "Cancel");
return 1;
}
if(!strcmp(cmdtext, "/relax", true))
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX, "are you sure?", "Are you sure you have time to relax?", "yes", "no");
return 1;
}
return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)//they pressed the first button
{
switch(dialogid)//if your using only one dialog this isn't needed but you never know.
{
case 1://our dialog
{
switch(listitem)//wich listitem is chosen
{
case 0://the first item in the list
{
if(GetPlayerMoney(playerid) < 1) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -1);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
}
case 1:
{
if(GetPlayerMoney(playerid) < 2) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -2);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
}
case 2:
{
if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -3);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
}
}
}
//from here we added things
case 2://the new dialog
{
ApplyAnimation(playerid,"BEACH","Lay_Bac_Loop",4.1 ,1,1,1,1,10);//this will let you relax for 10 seconds
}
//till here
}
}
return 1;
}
Reply
#5

That means dialog id's are conflicting, try changing the ID's to a random number.
Reply
#6

Sometimes if the dialog isn't in the GM or the 1st or second FS submenu's dont show try putting it (the dialog) in the GM or 1st FS thats loaded and try that. I'v had this problem many times and this fixes it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)