Dialog box help please?
#1

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;
    }
Reply
#2

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;
}
Reply
#3

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

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
Reply
#5

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)