SA-MP Forums Archive
Help? - 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: Help? (/showthread.php?tid=472526)



Help? - eblood1 - 29.10.2013

how i can make "next" to show another dialog on /cmds with dialog MSGBOX


Re: Help? - SAMProductions - 29.10.2013

Like This ?

pawn Код:
CMD:testdialogcmd(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_TESTDIALOG1, DIALOG_STYLE_LIST, "{FF0000}Test Dialogs", "{FF0000}Test Dialog 1:\nTest Item 1\nTest Item 2\nTest Item 3\nTest Item 4\nTest Item 5\n{00FF00}NEXT", "Ok", "");
    }
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_TESTDIALOG1)
    {
        switch(listitem)
        {
            case 0:
            {
                //Selected Item: "{FF0000}Test Dialog 1"
            }
            case 1:
            {
                //Selected Item: "Test Item 1"
            }
            case 2:
            {
                //Selected Item: "Test Item 2"
            }
            case 3:
            {
                //Selected Item: "Test Item 3"
            }
            case 4:
            {
                //Selected Item: "Test Item 4"
            }
            case 5:
            {
                //Selected Item: "Test Item 5"
            }
            case 6:
            {
                ShowPlayerDialog(playerid, DIALOG_TESTDIALOG2, DIALOG_STYLE_LIST, "Test Dialogs", "{FF0000}Test Dialog 2:\nTest1\nTest2\nTest3\nTest4\nTest5", "OK", "");
            }
        }
    }
    if(dialogid == DIALOG_TESTDIALOG2)
    {
        switch(listitem)
        {
            case 0:
            {
                //Selected Item: "{FF0000}Test Dialog 2"
            }
            case 1:
            {
                //Selected Item: "Test1"
            }
            case 2:
            {
                //Selected Item: "Test2"
            }
            case 3:
            {
                //Selected Item: "Test3"
            }
            case 4:
            {
                //Selected Item: "Test4"
            }
            case 5:
            {
                //Selected Item: "Test5"
            }
        }
    }
    return 1;
}
By the way i am using ZCMD:

Код:
#include <zcmd>
If you want to use it with CMDs, All you need to do is:

Код:
			case 0:
			{
				//Selected Item: "{FF0000}Test Dialog 1"
			}
			case 1:
			{
				cmd_yourcommandname
			}
Change "cmd_yourcommandname" into your Commands, like for example "cmd_ann" = Announce Command.


Re: Help? - eblood1 - 29.10.2013

Quote:
Originally Posted by SAMProductions
Посмотреть сообщение
Like This ?

pawn Код:
CMD:testdialogcmd(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_TESTDIALOG1, DIALOG_STYLE_LIST, "{FF0000}Test Dialogs", "{FF0000}Test Dialog 1:\nTest Item 1\nTest Item 2\nTest Item 3\nTest Item 4\nTest Item 5\n{00FF00}NEXT", "Ok", "");
    }
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_TESTDIALOG1)
    {
        switch(listitem)
        {
            case 0:
            {
                //Selected Item: "{FF0000}Test Dialog 1"
            }
            case 1:
            {
                //Selected Item: "Test Item 1"
            }
            case 2:
            {
                //Selected Item: "Test Item 2"
            }
            case 3:
            {
                //Selected Item: "Test Item 3"
            }
            case 4:
            {
                //Selected Item: "Test Item 4"
            }
            case 5:
            {
                //Selected Item: "Test Item 5"
            }
            case 6:
            {
                ShowPlayerDialog(playerid, DIALOG_TESTDIALOG2, DIALOG_STYLE_LIST, "Test Dialogs", "{FF0000}Test Dialog 2:\nTest1\nTest2\nTest3\nTest4\nTest5", "OK", "");
            }
        }
    }
    if(dialogid == DIALOG_TESTDIALOG2)
    {
        switch(listitem)
        {
            case 0:
            {
                //Selected Item: "{FF0000}Test Dialog 2"
            }
            case 1:
            {
                //Selected Item: "Test1"
            }
            case 2:
            {
                //Selected Item: "Test2"
            }
            case 3:
            {
                //Selected Item: "Test3"
            }
            case 4:
            {
                //Selected Item: "Test4"
            }
            case 5:
            {
                //Selected Item: "Test5"
            }
        }
    }
    return 1;
}
By the way i am using ZCMD:

Код:
#include <zcmd>
If you want to use it with CMDs, All you need to do is:

Код:
			case 0:
			{
				//Selected Item: "{FF0000}Test Dialog 1"
			}
			case 1:
			{
				cmd_yourcommandname
			}
Change "cmd_yourcommandname" into your Commands, like for example "cmd_ann" = Announce Command.
mhmh minse is different, it does not look like that
Код:
CommandsDialog(playerid, title[])			// --- Commands Dialog --- //
{
    new string[2048];
	strcat(string, "\
	/Accept\t\t\t- Accept a duel request\n\
	{3C3B3D}________________________________________________________________________\n\
	/Buy\t\t\t- Buy a property\n\
	{3C3B3D}________________________________________________________________________\n\
	/Calc\t\t\t- Calculator\n\
    {3C3B3D}________________________________________________________________________\n\
	/Carchase\t\t- Locate the Carchase vehicle\n\
	{3C3B3D}________________________________________________________________________\n\
	");
	strcat(string, "\
	/Carcolor\t\t- Change your car color\n\
	{3C3B3D}________________________________________________________________________\n\
	/Chance\t\t- Take a chance\n\
	{3C3B3D}________________________________________________________________________\n\
	/Color\t\t\t- Change your color\n\
	{3C3B3D}________________________________________________________________________\n\
	/Deny\t\t\t- Deny a duel request\n\
	{3C3B3D}________________________________________________________________________\n\
	");
	strcat(string, "\
	/DM\t\t\t- See a list of Deathmatches\n\
	{3C3B3D}________________________________________________________________________\n\
	/Duel\t\t\t- Duel a player\n\
	{3C3B3D}________________________________________________________________________\n\
	/Eject\t\t\t- Eject a player from your vehicle\n\
	{3C3B3D}________________________________________________________________________\n\
	/Fs\t\t\t- Change your fighting style\n\
	");
	strcat(string, "\
	{3C3B3D}________________________________________________________________________\n\
	/Getid\t\t\t- Get a players ID\n\
	{3C3B3D}________________________________________________________________________\n\
 	/Goto\t\t\t- Teleport to a player\n\
    {3C3B3D}________________________________________________________________________\n\
 	/Jetpack\t\t- Get a jackpack\n\
 	{3C3B3D}________________________________________________________________________\n\
 	");
	strcat(string, "\
 	/Join\t\t\t- Join a race\n\
 	{3C3B3D}________________________________________________________________________\n\
 	/Loadpos\t\t- Load your saved position\n\
 	{3C3B3D}________________________________________________________________________\n\
 	/Lock\t\t\t- Lock your vehicles doors\n\
 	{3C3B3D}________________________________________________________________________\n\
 	/Myprops\t\t- See a list of properties you own\n\
 	");
	strcat(string, "\
 	{3C3B3D}________________________________________________________________________\n\
 	/Nitro\t\t\t- Toggle nitro On / Off\n\
 	{3C3B3D}________________________________________________________________________\n\
 	/Para\t\t\t- Get a parachute\n\
 	{3C3B3D}________________________________________________________________________\n\
 	/Pay\t\t\t- Give a player some of your money\n\
 	{3C3B3D}________________________________________________________________________\n\
 	/PM\t\t\t- Send a private message\n\
 	");
    ShowPlayerDialog(playerid, Cmds_Dialog, MSGBOX, title, string, "Next", "Close");
	return 1;
}



Re: Help? - SAMProductions - 29.10.2013

Try This:

pawn Код:
CommandsDialog(playerid, title[])           // --- Commands Dialog --- //
{
    new string[2048];
    strcat(string, "\
    /Accept\t\t\t- Accept a duel request\n\
    {3C3B3D}________________________________________________________________________\n\
    /Buy\t\t\t- Buy a property\n\
    {3C3B3D}________________________________________________________________________\n\
    /Calc\t\t\t- Calculator\n\
    {3C3B3D}________________________________________________________________________\n\
    /Carchase\t\t- Locate the Carchase vehicle\n\
    {3C3B3D}________________________________________________________________________\n\
    "
);
    strcat(string, "\
    /Carcolor\t\t- Change your car color\n\
    {3C3B3D}________________________________________________________________________\n\
    /Chance\t\t- Take a chance\n\
    {3C3B3D}________________________________________________________________________\n\
    /Color\t\t\t- Change your color\n\
    {3C3B3D}________________________________________________________________________\n\
    /Deny\t\t\t- Deny a duel request\n\
    {3C3B3D}________________________________________________________________________\n\
    "
);
    strcat(string, "\
    /DM\t\t\t- See a list of Deathmatches\n\
    {3C3B3D}________________________________________________________________________\n\
    /Duel\t\t\t- Duel a player\n\
    {3C3B3D}________________________________________________________________________\n\
    /Eject\t\t\t- Eject a player from your vehicle\n\
    {3C3B3D}________________________________________________________________________\n\
    /Fs\t\t\t- Change your fighting style\n\
    "
);
    strcat(string, "\
    {3C3B3D}________________________________________________________________________\n\
    /Getid\t\t\t- Get a players ID\n\
    {3C3B3D}________________________________________________________________________\n\
    /Goto\t\t\t- Teleport to a player\n\
    {3C3B3D}________________________________________________________________________\n\
    /Jetpack\t\t- Get a jackpack\n\
    {3C3B3D}________________________________________________________________________\n\
    "
);
    strcat(string, "\
    /Join\t\t\t- Join a race\n\
    {3C3B3D}________________________________________________________________________\n\
    /Loadpos\t\t- Load your saved position\n\
    {3C3B3D}________________________________________________________________________\n\
    /Lock\t\t\t- Lock your vehicles doors\n\
    {3C3B3D}________________________________________________________________________\n\
    /Myprops\t\t- See a list of properties you own\n\
    "
);
    strcat(string, "\
    {3C3B3D}________________________________________________________________________\n\
    /Nitro\t\t\t- Toggle nitro On / Off\n\
    {3C3B3D}________________________________________________________________________\n\
    /Para\t\t\t- Get a parachute\n\
    {3C3B3D}________________________________________________________________________\n\
    /Pay\t\t\t- Give a player some of your money\n\
    {3C3B3D}________________________________________________________________________\n\
    /PM\t\t\t- Send a private message\n\
    "
);
        strcat(string, "{FF0000}NEXT");
    ShowPlayerDialog(playerid, DIALOG_Cmds_Dialog, MSGBOX, title, string, "OK", "Close");
    return 1;
}
and Add new Dialog, for example the name of the Dialog is "DIALOG_Cmds_Dialog2" the other one name is "DIALOG_Cmds_Dialog"

Now Lets go on the OnDialogResponse:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_Cmds_Dialog)
    {
        switch(listitem)
        {
            case 0:
            {
                //Selected Item: "{FF0000}Cmds Dialog 1"
            }
            case 1:
            {
                //Strcat Code: "1"
            }
            case 2:
            {
                //Strcat Code: "2"
            }
            case 3:
            {
                //Strcat Code: "3"
            }
            case 4:
            {
                //Strcat Code: "4"
            }
            case 5:
            {
                //Strcat Code: "5"
            }
            case 6:
            {
                //Strcat Code: "6"
            }
            case 7:
            {
                ShowPlayerDialog(playerid, DIALOG_Cmds_Dialog2, DIALOG_STYLE_LIST, "Title = Test", "{FF0000}Test Dialog 2:\nTest1\nTest2\nTest3\nTest4\nTest5", "OK", "");
            }
        }
    }
    if(dialogid == DIALOG_Cmds_Dialog2)
    {
        switch(listitem)
        {
            case 0:
            {
                //Selected Item: "{FF0000}Cmds Dialog 2"
            }
            case 1:
            {
                //Selected Item: "Test1"
            }
            case 2:
            {
                //Selected Item: "Test2"
            }
            case 3:
            {
                //Selected Item: "Test3"
            }
            case 4:
            {
                //Selected Item: "Test4"
            }
            case 5:
            {
                //Selected Item: "Test5"
            }
        }
    }
    return 1;
}



Re: Help? - eblood1 - 29.10.2013

mhhm ok


Re: Help? - Pottus - 29.10.2013

Do it how the pros do dialogs

pawn Код:
#include <YSI\y_inline>
#include <YSI\y_dialog>
#include <YSI\y_commands>

CMD:testdialog(playerid, arg[])
{
    inline ViewInfo(vpid, vdialogid, vresponse, vlistitem, string:vtext[])
    {
        #pragma unused vlistitem, vdialogid, vpid, vtext
        if(vresponse)
        {
            inline ShowInfo(spid, sdialogid, sresponse, slistitem, string:stext[])
            {
                #pragma unused slistitem, sdialogid, spid, stext
                if(sresponse) SendClientMessage(playerid, -1, "You closed the info box with ok!");
                else SendClientMessage(playerid, -1, "You closed the info box with cancel!");
            }
            Dialog_ShowCallback(playerid, using inline ShowInfo, DIALOG_STYLE_MSGBOX, "Info", "This is a inline dialog", "Ok", "Close");
        }
        else SendClientMessage(playerid, -1, "You chose not to see the info box!");
    }
    Dialog_ShowCallback(playerid, using inline ViewInfo, DIALOG_STYLE_MSGBOX, "Show info?", "Info", "Show", "Close");

    return 1;
}