SA-MP Forums Archive
Responsive Dialog - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Responsive Dialog (/showthread.php?tid=654485)



Responsive Dialog - Mo123 - 29.05.2018

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;
    }



Re: Responsive Dialog - Exhibit - 29.05.2018

What are the errors?


Re: Responsive Dialog - RxErT - 29.05.2018

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.


Re: Responsive Dialog - Mo123 - 29.05.2018

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


Re: Responsive Dialog - iSpark - 29.05.2018

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.