[Tutorial] How to create a simple help dialog (For newbies)
#1

Hello,

In here, I am going to show you how to create a basic help dialog with pages.

What do i need?

Just focus with me .

Start:

At the top of your script, Put:

pawn Код:
#define DIALOG_HELP1 4500
#define DIALOG_HELP2 4501
#define DIALOG_HELP3 4502
Now at your commands (ZCMD or YCMD), Use:

pawn Код:
CMD:help(playerid,params[]);
{
    ShowPlayerDialog(playerid, DIALOG_HELP1, DIALOG_STYLE_MSGBOX, "Help: Page 1", "Put your message here\nPut your message here", "Next Page", "Cancel");
    return 1;
}
Find OnDialogResponse:, Type this under:

pawn Код:
switch dialogid;
{
    case DIALOG_HELP1:
    {
        if(response)
        {
           ShowPlayerDialog(playerid, DIALOG_HELP2, DIALOG_STYLE_MSGBOX, "Help: Page 2", "Put your messages here\nPut your messages here", "Next Page", "First Page");
        }
    }
    case DIALOG_HELP2:
    {
        if(response)
        {
           ShowPlayerDialog(playerid, DIALOG_HELP3, DIALOG_STYLE_MSGBOX, "Help: Page 3", "Put your message here\nPut your message here", "First Page", "Second Page");
        }
        else
        {
            ShowPlayerDialog(playerid, DIALOG_HELP1, DIALOG_STYLE_MSGBOX, "Help: Page 1", "Put your message     here\nPut your message here", "Next Page", "Cancel");
        }
    }
    case DIALOG_HELP3:
    {
        if(response)
        {
            ShowPlayerDialog(playerid, DIALOG_HELP1, DIALOG_STYLE_MSGBOX, "Help: Page 1", "Put your message here\nPut your message here", "Next Page", "Cancel");
        }
        else
        {
            ShowPlayerDialog(playerid, DIALOG_HELP2, DIALOG_STYLE_MSGBOX, "Help: Page 2", "Put your message here\nPut your message here", "Next Page", "First Pagel");
        }
    }
Well, That is it.

At "Put your messages here", It means enter your help words here :P.

If this helped you, +Rep me.

Reply
#2

Using an enumerator to assign dialogids is usually more maintainable; if the ids ever need to change you only have to edit the first one instead of the entire list. Using a switch statement to select the proper dialogid in OnDialogResponse is also bound to be faster than checking each dialogid individually.
Reply
#3

Well, Thank you for your suggestion, Editing it now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)