Question about dialogs
#3

Quote:
Originally Posted by HuntingMan
Посмотреть сообщение
ShowPlayerDialog(playerid, DIALOG_EX, DIALOG_STYLE_LIST, "Choose items ","1st\n2nd\n3rd\n4th","Ok","Cancel");

pawn Код:
if(dialogid == DIALOG_EX)
{
if(!response) return SendClientMessage(playerid,0x0498FBC8,"Selection Cancled");
if(response)
{
new string[300];
new msg[200];
if(listitem == 0)
{
//1stitem
return 1;
}
if(listitem == 1)
{
//2nd
return 1;
}
if(listitem == 2)
{
//3rd
return 1;
}
if(listitem == 3)
{
//4th
return 1;
}
}
and etc
Doing it this way is less efficient than using cases. If you're looking for a way to shorten up the list, it depends on how it's coded. For example, if several of the options will lead to the same result, you can bundle it up as one with cases.

pawn Код:
switch(listitem)
{
    //Let's say listitem 0-3 will lead to the same result
    case 0..3:
    {
        //Whatever code you place in here will work for the first 3 options.
    }
}
Reply


Messages In This Thread
Question about dialogs - by barbarbar1 - 24.04.2016, 18:16
Re: Question about dialogs - by HuntingMan - 24.04.2016, 18:26
Re: Question about dialogs - by DTV - 24.04.2016, 20:44

Forum Jump:


Users browsing this thread: 1 Guest(s)