OnDialogResponse problem
#1

Solved
Reply
#2

Trying to get that to work too :P
Reply
#3

You doing it wrong.
It must be like this

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) // Answers: 2,1,3,1,2,3,1
{
    if(dialogid == 3) //The same just like i did below
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {

                }
                case 1:
                {

                }
                case 2:
                {
               
                }
            }
        }
        return 1;
    }
    if(dialogid == 2)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    ///me thinks about Allen's clothes.
                }
                case 1:
                {
                    ///me laughs at Allen's joke.
                }
                case 2:
                {
                    //me punches Allen in the face
                }
            }
        }
        return 1;
    }
}
Reply
#4

I tried to use this, but I got an error for basically every line. Can you tell me what I did wrong?

pawn Код:
if(dialogid == 2)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            switch(listitem)
            {
                case 2:
                {
                    ShowPlayerDialog(playerid,3,2, "What's a good example of a '/do'?{007F46} (2/7)", "/do My hair appears to be brown.\n/do Smiles at Jordan.\n/do Where is Cluckin' Bell?", "Select", "Cancel");
                }
                else Kick(playerid);
            }
        }
        return 1;
    }
Reply
#5

stop using else inside the switch.

i already give you the example.

Example

pawn Код:
ShowPlayerDialog(playerid, 0, 2, "Who is my gf", "Lady Gaga\nJustin Bieber\nNicki Minaj", "Choose", "Exit");
pawn Код:
if(dialogid == 0)
{
      switch(listitem)
      {
            case 0: //lady gaga
            {
                 GameTextForPlayer(playerid, "~r~Wrong", 3000, 3);
                 Kick(playerid);
            }
            case 1: //justin bieber
            {
                 GameTextForPlayer(playerid, "~g~Correct~n~~w~He is gay!", 4500, 3);
            }            
            case 2: //Nicki Minaj
            {
                 GameTextForPlayer(playerid, "~r~Wrong", 3000, 3);
                 Kick(playerid);
            }
 
      }
}
Reply
#6

By the way, this is redundant...

pawn Код:
if(!response) return Kick(playerid);
if(response)
You only need to check if the response was 0/false, there's no reason to check if it was 1/true. So, just do this:

pawn Код:
if(!response)
   return Kick(playerid);
Reply
#7

Nevermind
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)