Dialog wont work right
#1

Hey,

i createt a dialog with response and stuff but when the dialog is open it should close when i press "ESC" or when i click on the second button what did i wrong?

Код HTML:
ocmd:navi(playerid,params[])
{
	ShowPlayerDialog(playerid, DIALOG_NAVI1, DIALOG_STYLE_LIST, "Navigationssystem", "•List 1\n•List 2\nList 3", "Choose this", "cancel");
	return 1;
}
Код HTML:
	if(dialogid == DIALOG_NAVI1)
	switch(listitem)
	{
		case 0:
		{
      		ShowPlayerDialog(playerid, DIALOG_NAVI2, DIALOG_STYLE_LIST, "Navigationssystem", "•alist1\n•alist2\n•alist3", "choose", "cancel");
		}
		case 1:
  		{
		}
		case 2:
		{
		}
		case 3:
  		{
		}
	}
When i press on cancel it is choosing the one and when i press ESC it is choosing to.
Reply
#2

Код:
case DIALOG_NAVI1:
{
    if(response)
    {
	switch(listitem)
	{
		case 0:
		{
      		ShowPlayerDialog(playerid, DIALOG_NAVI2, DIALOG_STYLE_LIST, "Navigationssystem", "•alist1\n•alist2\n•alist3", "choose", "cancel");
		}
		case 1:
  		{
		}
		case 2:
		{
		}
		case 3:
  		{
		}
            }
        }
 }
Reply
#3

Thanks U!
Reply
#4

Quote:
Originally Posted by BrightLeaN
Посмотреть сообщение
Thanks U!
Anytime, instead of DIALOG_NAVI2 you can also you DIALOG_NAVI+1, DIALOG_NAVI+2 and so on for ez life!
Reply
#5

Quote:
Originally Posted by UFF
Посмотреть сообщение
Anytime, instead of DIALOG_NAVI2 you can also you DIALOG_NAVI+1, DIALOG_NAVI+2 and so on for ez life!
Exactly, and this means you only have to define it once.

Код:
#define dialog 1000

if(dialogid == dialog)
if(dialogid == dialog+1)
if(dialogid == dialog+2)
Reply
#6

PHP код:
// Make sure to define each dialog with a unique number
#define DIALOG_NAVI1 1
#define DIALOG_NAVI2 2
ocmd:navi(playerid,params[])
{
    
ShowPlayerDialog(playeridDIALOG_NAVI1DIALOG_STYLE_LIST"Navigation system""•List 1\n•List 2\n•List 3""Choose""Cancel");
    return 
1;
}
// OnDialogResponse
if(dialogid == DIALOG_NAVI1)
{
    if(
response// if user selected something
    
{
        switch(
listitem)
        {
            case 
0// User has selected the 1st item in list from DIALOG_NAVI1
            
{
                  
ShowPlayerDialog(playeridDIALOG_NAVI2DIALOG_STYLE_LIST"Navigation system""•alist1\n•alist2\n•alist3""Choose""Cancel");
            }
            case 
1// User has selected the 2nd item in list from DIALOG_NAVI1
            
{
                  
// do something
            
}
            case 
2// User has selected the 3rd item in list from DIALOG_NAVI1
            
{
                  
// do something
            
}
        }
    }
}
if(
dialogid == DIALOG_NAVI2)
{
    if(
response)
    {
        switch(
listitem)
        {
            case 
0SendClientMessage(playerid, -1"1. item selected");
            case 
1SendClientMessage(playerid, -1"2. item selected");
            case 
2SendClientMessage(playerid, -1"3. item selected");
        }
    }

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)