FDLG Help
#1

I'm using FDialog to create dialogs and I just realized that using definitions for the dialogs doesn't work. For example:

The following will display the dialog, but when I click "Yes" it does nothing.

pawn Код:
#define DIALOG_TEST 1

//OnPlayerConnect

ShowPlayerDialog(playerid, DIALOG_TEST, DIALOG_STYLE_INPUT, "Test", "Test", "Yes", "No");

//later on

fDialog(DIALOG_TEST)
{
      if(response)
      {
          SendClientMessage(playerid, RED, "Hello");
      }
      return 1;
}
To get it to work, I have to use fDialog(1) instead of fDialog(DIALOG_TEST). Any idea why?
Reply
#2

Suggestion, use y_inline / y_dialog it's honestly the best dialog system there is and easy to use.

Anyways, you have fDialog(DIALOG_TEST) should this not be fDialog(DIALOG_TEST, reponse) ?
Reply
#3

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Suggestion, use y_inline / y_dialog it's honestly the best dialog system there is and easy to use.

Anyways, you have fDialog(DIALOG_TEST) should this not be fDialog(DIALOG_TEST, reponse) ?
fDialog(1) works fine, it's just fDialog(DIALOG_TEST) that doesn't. I'll look into y_dialog. What makes it better than FDLG?
Reply
#4

You can write all your dialog code into the function that uses it without a need for making dialogid defines and callback functions which is much better for keeping your code organized, as a matter of fact I would never even consider doing dialogs any other way.

Here is an example.

pawn Код:
// Set gang name
CMD:gangname(playerid, arg[])
{
    // Is player in a gang?
    if(p_DATA[playerid][p_GangID] != 0)
    {
        // Is player leader ?
        if(p_DATA[playerid][p_GangRank] == 1)
        {
            inline Response(pid, dialogid, response, listitem, string:text[])
            {
                #pragma unused listitem, dialogid, pid
                if (response)
                {
                    if(strlen(text) > 3 || strlen(text) <= 30)
                    {
                        new line[128];
                        format(line, sizeof(line), "%s gang is now known as %s", Gang_Name[p_DATA[playerid][p_GangSlot]], text);
                        SendClientMessageToAll(STEALTH_YELLOW, line);
                        format(Gang_Name[p_DATA[playerid][p_GangSlot]], 32, "%s", text);
                        // Save gang name to DB
                        SaveGangName(p_DATA[playerid][p_GangSlot]);
                    }
                    else
                    {
                        SendClientMessage(playerid, STEALTH_YELLOW, "Gang names must be more than 4 characters and no more than 30");
                        Dialog_ShowCallback(playerid, using inline Response, DIALOG_STYLE_INPUT, "Enter a name for your gang", "New Gang Name", "Ok", "Cancel");
                    }
                }
            }
            Dialog_ShowCallback(playerid, using inline Response, DIALOG_STYLE_INPUT, "Enter a name for your gang", "New Gang Name", "Ok", "Cancel");
        }
        else SendClientMessage(playerid, STEALTH_YELLOW, "You must be gang leader to use this command.");
    }
    else SendClientMessage(playerid, STEALTH_YELLOW, "You are not a in a gang");
    return 1;
}
Don't you think that looks a lot better and makes more sense than traditional methods?
Reply
#5

I've read the tutorial, but I still don't completely understand how it works. So you use inline Response to choose what the dialog does and you show the player the dialog using Dialog_ShowCallback?

When should I use Dialog_Show and when should I use Dialog_ShowCallback and when should I use ShowPlayerDialog? (I see all of them used in ******'s tutorial.)

Is this method more efficient or less efficient (optimized) than using FDLG, and if so how much so?
Reply
#6

You'd have to ask ****** about that but I'm guessing it's probably around the same.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)