SA-MP Forums Archive
Dialog box help please? - 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: Dialog box help please? (/showthread.php?tid=401255)



Dialog box help please? - Riggster - 22.12.2012

Can anyone show me how this code would go into the part OnDialogResponse because I cant get any of the tutorials to work for me so can you help me please?

Код:
    if(strcmp(cmdtext,"/weapons",true)==0)
    {
    ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Weapons","1.Degal\n2.Shotgun\n3.MP5\n4.M4\n5.AK\n6
.Sniper","Get","Exit");
    return 1;
    }



Re: Dialog box help please? - Konstantinos - 22.12.2012

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 1:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        //code for Degal
                        return 1;
                    }
                    case 1:
                    {
                        //code for Shotgun
                        return 1;
                    }
                    case 2:
                    {
                        //code for Mp5
                        return 1;
                    }
                    case 3:
                    {
                        //code for M4
                        return 1;
                    }
                    case 4:
                    {
                        //code for AK
                        return 1;
                    }
                    case 5:
                    {
                        //code for Sniper
                        return 1;
                    }
                }
            }
        }
    }
    return 1;
}



Re: Dialog box help please? - Riggster - 22.12.2012

Does it have to be in that weird shape or can it all go on a straight line?


Re: Dialog box help please? - park4bmx - 22.12.2012

Quote:
Originally Posted by Riggster
Посмотреть сообщение
Does it have to be in that weird shape or can it all go on a straight line?
it can but this way it keeps the code more neater.
and easier to find open/closing brackets in future.
Quote:

This forum requires that you wait 120 seconds between posts.

Again ;X


Re: Dialog box help please? - Konstantinos - 22.12.2012

There is a limit on how long a line should be. You can't add all this in one line, because it'll give you errors.
Furthermore, it is readable like this, this is what the most want, I guess!