Responsive Dialog
#1

So I want Attach and Deattach to display a message after clicking

The whole process goes like this /help -> Suppression System -> Attach -> Display Message

I get errors like OnDialogResponse should show a value and that SendClientMessage is already a defined symbol


pawn Код:
#define DIALOG_SUPPRESSION 1
pawn Код:
CMD:help(playerid, params[])
 {
        ShowPlayerDialog(playerid, DIALOG_SUPPRESSION, DIALOG_STYLE_LIST, "Commands", "Suppression System", "Continue", "Cancel");
        return 1;
 }
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_SUPPRESSION)
    {
        if(response)
        {
            ShowPlayerDialog(playerid, DIALOG_SUPPRESSION, DIALOG_STYLE_LIST, "Commands", "Attach\nDeattach", "Continue", "Cancel");
        }
        return 1;
}}
    if(dialogid == DIALOG_SUPPRESSION)
    {
        if(response)
        {
            if(listitem == 0)
            {
           
                     SendClientMessage(playerid, COLOR_AQUA, "TEST");
            }
            if(listitem == 1)
                       {

                                     SendClientMessage(playerid, COLOR_AQUA, "TEEEEST");
            }
         }
             return 1;
    }
Reply
#2

What are the errors?
Reply
#3

Try this now:

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_SUPPRESSION)
    {
        if(
response)
        {
            
ShowPlayerDialog(playeridDIALOG_SUPPRESSIONDIALOG_STYLE_LIST"Commands""Attach\nDeattach""Continue""Cancel");
        }
    }
    if(
dialogid == DIALOG_SUPPRESSION)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
            
                    
SendClientMessage(playeridCOLOR_AQUA"TEST");
             }
            if(
listitem == 1)
            {

                    
SendClientMessage(playeridCOLOR_AQUA"TEEEEST");
            }
        }
    }
    return 
1;

You probably forgot to return a value for OnDialogResponse return 1; and missed a bracket.
Reply
#4

Quote:
Originally Posted by RxErT
Посмотреть сообщение
Try this now:

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_SUPPRESSION)
    {
        if(
response)
        {
            
ShowPlayerDialog(playeridDIALOG_SUPPRESSIONDIALOG_STYLE_LIST"Commands""Attach\nDeattach""Continue""Cancel");
        }
    }
    if(
dialogid == DIALOG_SUPPRESSION)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
            
                    
SendClientMessage(playeridCOLOR_AQUA"TEST");
             }
            if(
listitem == 1)
            {
                    
SendClientMessage(playeridCOLOR_AQUA"TEEEEST");
            }
        }
    }
    return 
1;

You probably forgot to return a value for OnDialogResponse return 1; and missed a bracket.
thank u my dude

but when i do /help > suppression system the message from listitem 0 pops up
Reply
#5

PHP код:
#define DIALOG_HELP 0
#define DIALOG_SUPPRESSION_HELP 1
CMD:help(playeridparams[])
{
    
ShowPlayerDialog(playeridDIALOG_HELPDIALOG_STYLE_LIST"Commands""Suppressor\nSome shit""Continue""Cancel");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_HELP:
        {
            if(
response)
                return 
ShowPlayerDialog(playeridDIALOG_SUPPRESSION_HELPDIALOG_STYLE_LIST"Commands""Attach\nDettach""Yes""Exit");
        }
        case 
DIALOG_SUPPRESSION_HELP:
        {
            if(
response)
            {
                switch(
listitem)
                {
                    case 
0:
                        return 
SendClientMessage(playerid, -1"Attach");
                    case 
1:
                        return 
SendClientMessage(playerid, -1"Dettach");
                }
            }
            else
                return 
ShowPlayerDialog(playeridDIALOG_HELPDIALOG_STYLE_LIST"Commands""Suppressor\nSome shit""Continue""Cancel");
        }
    }
    return 
1;

P.S. Work on your indentation.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)