Return command on dialogresponse?
#1

When someone clicks OK or cancel I want them to return back to the previous dialog.

What I tried:
pawn Код:
Dialog:GeneralCommandsDialog(playerid, response, listitem, inputtext[])
{
    if(response){
    return cmd_commands(playerid, params[])
    }
    return 1;
}
Will not compile as params is undefined even when I add #pragma unused params above the code.

Anyone? I prefer not having tons of code to edit
Reply
#2

You could return to the if(response) like

pawn Код:
if(response) return ShowPlayerDialog(DIALOGSTUFFHERE)
If you dont know how to do it, give me the dialog code ill do it for you

EDIT: And give me the Dialog Define ID
Reply
#3

EasyDialog doesn't use IDs, this is how it looks when it works but if I decide to add something I'll have to edit several lines.
pawn Код:
Dialog:CommandsDialog(playerid, response, listitem, inputtext[])
{
    if (response)
    {
        switch(listitem)
        {
            case 0:
            {
                Dialog_Show(playerid, GeneralCommands, DIALOG_STYLE_MSGBOX, "{FFFFFF}General Commands", "{FFFFFF}A list of general commands:\n\n{FF8000}/jobs{FFFFFF}                  Select a job if you failed to choose one on spawn.\n{FF8000}/about{FFFFFF}                Display general information and credits.\n{FF8000}/changelog{FFFFFF}        Show what's new in this current version.\n{FF8000}/kill{FFFFFF}                    Kill yourself if stuck.\n{FF8000}/admins{FFFFFF}             List of administrators currently online.\n{FF8000}/pm{FFFFFF}                    Send a private message.\n{FF8000}/ignore{FFFFFF}               Ignore annoying players.\n{FF8000}/blockpms{FFFFFF}          Block all incoming PMs.\n{FF8000}/locate{FFFFFF}                Locate a player.\n{FF8000}/givecash{FFFFFF}           Send cash to a player.", "Ok", "");
            }
            case 1:
            {
                Dialog_Show(playerid, JobCommands, DIALOG_STYLE_MSGBOX, "{FFFFFF}Job Commands", "{FFFFFF}Commands for your currently selected job: Car Jacker\n\n{FF8000}/sellcar{FFFFFF}            Sell your newly stolen car to nearest Car Crane.\n{FF8000}/carvalue{FFFFFF}         Display current vehicle's value.\n{FF8000}", "Ok", "");
                //Player[playerid][Job] == Job[playerid];
                //Dialog_Show(playerid, JobCommands, DIALOG_STYLE_MSGBOX, "{FFFFFF}Job Commands", "{FFFFFF}Commands for your currently selected job: %s\n\n{FF8000}/sellcar{FFFFFF}        Sell your newly stolen car to nearest Car Crane.\n{FF8000}/carvalue{FFFFFF}        Display current vehicle's value.\n{FF8000}", "Ok", "", Job[playerid]);
            }
            case 2:
            {
                Dialog_Show(playerid, PoliceCommands, DIALOG_STYLE_MSGBOX, "{FFFFFF}Police Commands", "{FFFFFF}A list of commands available for Police Officers:\n\n{FF8000}/arrest{FFFFFF}         Arrests closest criminal within your range.\n{FF8000}/ticket{FFFFFF}         Tickets closest criminal within your range.\n{FF8000}/mw            {FFFFFF}List of most wanted players and their current location.\n{FF8000}/warrants    {FFFFFF}List of wanted players and their current location.\n{FF8000}/respond     {FFFFFF}Respond to a emergency call.", "Ok", "");
            }
            case 3:
            {
                Dialog_Show(playerid, CriminalCommands, DIALOG_STYLE_MSGBOX, "{FFFFFF}Criminal Commands", "{FFFFFF}A list of commands available for Criminals:\n\n{FF8000}/rob{FFFFFF}            Rob closest player within your range\n{FF8000}/rape{FFFFFF}          Rape closest player within your range\n{FF8000}/holdup      {FFFFFF}Rob a store.{FF8000}\n/bankrob    {FFFFFF}Start a Bank Robbery.\n{FF8000}/sellcar       {FFFFFF}Sell a stolen vehicle to the car crane.", "Ok", "");
            }
            case 4:
            {
                Dialog_Show(playerid, VIPCommands, DIALOG_STYLE_MSGBOX, "{FFFFFF}VIP Commands", "{FFFFFF}A list of exclusive commands avaible to VIP only:\n\n{FF8000}/vc{FFFFFF}             VIP Chat\n{FF8000}/vcolor{FFFFFF}       Change the color of your current Vehicle.\n{FF8000}/vplate       {FFFFFF}Change the text of your vehicle plate.{FF8000}\n/vmods       {FFFFFF}Apply free mods to your vehicle", "Ok", "");
            }
        }
    }
    return 1;
}

Dialog:GeneralCommandsDialog(playerid, response, listitem, inputtext[])
{
    if(response) return Dialog_Show(playerid, CommandsDialog, DIALOG_STYLE_LIST, "Commands", "General Commands\nJob Commands\nPolice Commands\nCriminal Commands\nVIP Commands\n", "", "Close");
    return 1;
}
Dialog:JobCommands(playerid, response, listitem, inputtext[])
{
    if(response) return Dialog_Show(playerid, CommandsDialog, DIALOG_STYLE_LIST, "Commands", "General Commands\nJob Commands\nPolice Commands\nCriminal Commands\nVIP Commands\n", "", "Close");
    return 1;
}
Dialog:PoliceCommands(playerid, response, listitem, inputtext[])
{
    if(response) return Dialog_Show(playerid, CommandsDialog, DIALOG_STYLE_LIST, "Commands", "General Commands\nJob Commands\nPolice Commands\nCriminal Commands\nVIP Commands\n", "", "Close");
    return 1;
}
Dialog:CriminalCommands(playerid, response, listitem, inputtext[])
{
    if(response) return Dialog_Show(playerid, CommandsDialog, DIALOG_STYLE_LIST, "Commands", "General Commands\nJob Commands\nPolice Commands\nCriminal Commands\nVIP Commands\n", "", "Close");
    return 1;
}
Dialog:VIPCommands(playerid, response, listitem, inputtext[])
{
    if(response) return Dialog_Show(playerid, CommandsDialog, DIALOG_STYLE_LIST, "Commands", "General Commands\nJob Commands\nPolice Commands\nCriminal Commands\nVIP Commands\n", "", "Close");
    return 1;
}
Reply
#4

OK so now I defined the texts so I only have to edit them once, I now wonder if there's a simpler way to do it or if this is the only way.
pawn Код:
#define CommandsText "Commands", "General Commands\nJob Commands\nPolice Commands\nCriminal Commands\nVIP Commands\n", "", "Close"
#define GeneralCommandsText "{FFFFFF}General Commands", "{FFFFFF}A list of general commands:\n\n{FF8000}/jobs{FFFFFF}                  Select a job if you failed to choose one on spawn.\n{FF8000}/about{FFFFFF}                Display general information and credits.\n{FF8000}/changelog{FFFFFF}        Show what's new in this current version.\n{FF8000}/kill{FFFFFF}                    Kill yourself if stuck.\n{FF8000}/admins{FFFFFF}             List of administrators currently online.\n{FF8000}/pm{FFFFFF}                    Send a private message.\n{FF8000}/ignore{FFFFFF}               Ignore annoying players.\n{FF8000}/blockpms{FFFFFF}          Block all incoming PMs.\n{FF8000}/locate{FFFFFF}                Locate a player.\n{FF8000}/givecash{FFFFFF}           Send cash to a player.", "Ok", ""
#define JobCommandsText "{FFFFFF}Job Commands", "{FFFFFF}Commands for your currently selected job: Car Jacker\n\n{FF8000}/sellcar{FFFFFF}            Sell your newly stolen car to nearest Car Crane.\n{FF8000}/carvalue{FFFFFF}         Display current vehicle's value.\n{FF8000}", "Ok", ""
#define PoliceCommandsText "{FFFFFF}Police Commands", "{FFFFFF}A list of commands available for Police Officers:\n\n{FF8000}/arrest{FFFFFF}         Arrests closest criminal within your range.\n{FF8000}/ticket{FFFFFF}         Tickets closest criminal within your range.\n{FF8000}/mw            {FFFFFF}List of most wanted players and their current location.\n{FF8000}/warrants    {FFFFFF}List of wanted players and their current location.\n{FF8000}/respond     {FFFFFF}Respond to a emergency call.", "Ok", ""
#define CriminalCommandsText "{FFFFFF}Criminal Commands", "{FFFFFF}A list of commands available for Criminals:\n\n{FF8000}/rob{FFFFFF}            Rob closest player within your range\n{FF8000}/rape{FFFFFF}          Rape closest player within your range\n{FF8000}/holdup      {FFFFFF}Rob a store.{FF8000}\n/bankrob    {FFFFFF}Start a Bank Robbery.\n{FF8000}/sellcar       {FFFFFF}Sell a stolen vehicle to the car crane.", "Ok", ""
#define VIPCommandsText "{FFFFFF}VIP Commands", "{FFFFFF}A list of exclusive commands avaible to VIP only:\n\n{FF8000}/vc{FFFFFF}             VIP Chat\n{FF8000}/vcolor{FFFFFF}       Change the color of your current Vehicle.\n{FF8000}/vplate       {FFFFFF}Change the text of your vehicle plate.{FF8000}\n/vmods       {FFFFFF}Apply free mods to your vehicle", "Ok", ""
Dialog:CommandsDialog(playerid, response, listitem, inputtext[])
{
    if (response)
    {
        switch(listitem)
        {
            case 0:
            {
                Dialog_Show(playerid, GeneralCommands, DIALOG_STYLE_MSGBOX, GeneralCommandsText);
            }
            case 1:
            {
                Dialog_Show(playerid, JobCommands, DIALOG_STYLE_MSGBOX, JobCommandsText);
            }
            case 2:
            {
                Dialog_Show(playerid, PoliceCommands, DIALOG_STYLE_MSGBOX, PoliceCommandsText);
            }
            case 3:
            {
                Dialog_Show(playerid, CriminalCommands, DIALOG_STYLE_MSGBOX, CriminalCommandsText);
            }
            case 4:
            {
                Dialog_Show(playerid, VIPCommands, DIALOG_STYLE_MSGBOX, VIPCommandsText);
            }
        }
    }
    return 1;
}
Dialog:GeneralCommands(playerid, response, listitem, inputtext[])
{
    if(response) return Dialog_Show(playerid, CommandsDialog, DIALOG_STYLE_LIST, CommandsText);
    return 1;
}
Dialog:JobCommands(playerid, response, listitem, inputtext[])
{
    if(response) return Dialog_Show(playerid, CommandsDialog, DIALOG_STYLE_LIST, CommandsText);
    return 1;
}
Dialog:PoliceCommands(playerid, response, listitem, inputtext[])
{
    if(response) return Dialog_Show(playerid, CommandsDialog, DIALOG_STYLE_LIST, CommandsText);
    return 1;
}
Dialog:CriminalCommands(playerid, response, listitem, inputtext[])
{
    if(response) return Dialog_Show(playerid, CommandsDialog, DIALOG_STYLE_LIST, CommandsText);
    return 1;
}
Dialog:VIPCommands(playerid, response, listitem, inputtext[])
{
    if(response) return Dialog_Show(playerid, CommandsDialog, DIALOG_STYLE_LIST, CommandsText);
    return 1;
}
/*
*
* Commands
*
*/

CMD:commands(playerid, params[])
{
    Dialog_Show(playerid, CommandsDialog, DIALOG_STYLE_LIST, CommandsText);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)