SA-MP Forums Archive
Qustion for ShowPlayerDialog - 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: Qustion for ShowPlayerDialog (/showthread.php?tid=282499)



Qustion for ShowPlayerDialog - Join7 - 11.09.2011

ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Title","title1\ntitle2\ntitle3","Buy","Other" );

I want by clicking on the "Other" and shows me another Dialog

This is "other":
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Title2","title4\ntitle5\ntitle6","Buy","Cance l");


Re: Qustion for ShowPlayerDialog - iggy1 - 11.09.2011

Check if there is no response IE,
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 0:
        {
            if(response)
            {
            }
            else//second button pressed or dialog cancelled.
            {
                //your stuff here
            }
        }
    }
    return 1;
}
If there is a response the first button (or a listitem) was pressed, otherwise button 2 has been pressed or the dialog cancelled.


Re: Qustion for ShowPlayerDialog - Join7 - 11.09.2011

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 0:
        {
            if(response)
            {
                        if(listitem == 0)
                        {
                              //..
                        }
            }
            else//second button pressed or dialog cancelled.
            {
                  ShowPlayerDialog(....);       
            }
        }
    }
    return 1;
}
so?


Re: Qustion for ShowPlayerDialog - iggy1 - 11.09.2011

That should do it.


Re: Qustion for ShowPlayerDialog - Join7 - 11.09.2011

Can you do an example


Re: Qustion for ShowPlayerDialog - AeroBlast - 11.09.2011

pawn Код:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Title","title1\ntitle2\ntitle3","Buy","Other" );

public OnPlayerDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 0:
        {
            if(response)
            {
                if(listitem == 0)
                {
                    SendClientMessage(playerid,0xFF0000FF,"title1");
                }
                if(listitem == 1)
                {
                    SendClientMessage(playerid,0xFF0000FF,"title2");
                }
                if(listitem == 2)
                {
                    SendClientMessage(playerid,0xFF0000FF,"title3");
                }
            }
            else
            {
                  ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Title2","title4\ntitle5\ntitle6","Buy","Cance l");  
            }
        }
    }
    return 1;
}



Re: Qustion for ShowPlayerDialog - Join7 - 11.09.2011

Doesn't working


Re: Qustion for ShowPlayerDialog - Babul - 11.09.2011

AeroBlast was quite close, only the case 0 was wrong checked (for dialogid 1):
Код:
public OnPlayerDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
		case 1:
		{
			if(response)
			{
				switch(listitem)
				{
					case 0:
					{
						SendClientMessage(playerid,0xFF0000FF,"title1");
					}
					case 1:
					{
						SendClientMessage(playerid,0xFF0000FF,"title2");
					}
					case 2:
					{
						SendClientMessage(playerid,0xFF0000FF,"title3");
					}
				}
			}
			else
			{
				ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Title2","title4\ntitle5\ntitle6","Buy","Cancel");  
			}
		}
		case 2:
		{
			if(response)
			{
				switch(listitem)
				{
					case 0:
					{
						SendClientMessage(playerid,0xFF0000FF,"title4");
					}
					case 1:
					{
						SendClientMessage(playerid,0xFF0000FF,"title5");
					}
					case 2:
					{
						SendClientMessage(playerid,0xFF0000FF,"title6");
					}
				}
			}
			else
			{
				ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Title1","title1\ntitle2\ntitle3","Buy","Back");  
			}
		}
	}
	return 1;
}



Re: Qustion for ShowPlayerDialog - Join7 - 11.09.2011

Thanks bro