[Tutorial] How to make a Dialog
#2

This is wrong.
pawn Code:
if(dialogid == DIALOG_STYLE_LIST)
dialogid == id, not the Dialog Style.
For example:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/your command", cmdtext, true, 6) == 0)
    {
        ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST,"Write here somethin","Blalblalba","Button1","Button2"); // you can change the dialog style so
   
        return 1;
    }
    return 0;
}
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid) // Lookup the dialogid
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
                return 1; // We processed it
            }
 
            switch(listitem) // This is far more efficient than using an if-elseif-else structure
            {
                case 0: // Listitems start with 0, not 1
                {
                    // What should happen when they click on the first item?
                }
                case 1:
                {
                    // And the second item?
                }
                case 2:
                {
                    // We can keep going on here ;)
                }
                // Add the rest of your listitems for dialog 1 here
 
            }
 
        }
        // Add the rest of your dialogs here
 
    }
    return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
}
It should return 0
Reply


Messages In This Thread
How to make a Dialog - by DaBeezy - 28.10.2011, 17:18
Re: How to make a Dialog - by Kostas' - 28.10.2011, 17:24
Re: How to make a Dialog - by DaBeezy - 28.10.2011, 17:26
Re: How to make a Dialog - by DaBeezy - 28.10.2011, 17:53
Re: How to make a Dialog - by DaBeezy - 29.10.2011, 11:25
Re: How to make a Dialog - by Infinity - 30.10.2011, 18:49
Re: How to make a Dialog - by DaBeezy - 31.10.2011, 18:52
Re: How to make a Dialog - by Private200 - 01.11.2012, 21:49
Re: How to make a Dialog - by gtakillerIV - 02.11.2012, 10:28

Forum Jump:


Users browsing this thread: 1 Guest(s)