SA-MP Forums Archive
Dialog wont work right - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog wont work right (/showthread.php?tid=652655)



Dialog wont work right - BrightLeaN - 16.04.2018

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.


Re: Dialog wont work right - UFF - 16.04.2018

Код:
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:
  		{
		}
            }
        }
 }



Re: Dialog wont work right - BrightLeaN - 16.04.2018

Thanks U!


Re: Dialog wont work right - UFF - 16.04.2018

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!


Re: Dialog wont work right - jasperschellekens - 16.04.2018

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)



Re: Dialog wont work right - kovac - 16.04.2018

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");
        }
    }