Dialog Buttons
#1

I've got this:
pawn Код:
public OnPlayerConnect(playerid)
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "What do you want to play?", "Pick the type of game you want to play./nFFA = Free For All/nTDM = Team Deathmatch", "FFA", "TDM");
    return 1;
}
And how can I make it so that if they press the "FFA" button, it does this:
pawn Код:
SendClientMessage(playerid, COLOR_WHITE, "You picked Free For All.");
And the TDM button does this:
pawn Код:
SendClientMessage(playerid, COLOR_WHITE, "You picked Team Deathmatch.");
I've got this, but it doesn't work:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  // We SHOULD use switch(dialogid) with cases, but we're only going to use one dialog in this tutorial.
  if(dialogid == 1 && response) // If the dialogid is 1 (our dialog) and they pressed 'Purchase'
  {
    // We'll use the switch/cases now because we're going to process a few results, not just one. Remember, the first item in the list has id 0.
    switch(listitem)
    {
      case 0:
      {
                SendClientMessage(playerid, COLOR_WHITE, "You picked Free For All.");
      }
      case 1:
      {
        SendClientMessage(playerid, COLOR_WHITE, "You picked Team Deathmatch.");
      }
    }
  }
  return 1;
}
Reply
#2

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == 1)
  {
    switch(response)
    {
      case 0:
      {
        SendClientMessage(playerid, COLOR_WHITE, "You picked Team Deathmatch.");
      }
      case 1:
      {
        SendClientMessage(playerid, COLOR_WHITE, "You picked Free For All.");
      }
    }
  }
  return 0;
}
Reply
#3

Thanks, it worked!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)