SA-MP Forums Archive
Dialog Buttons - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dialog Buttons (/showthread.php?tid=136947)



Dialog Buttons - jameskmonger - 27.03.2010

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



Re: Dialog Buttons - bajskorv123 - 27.03.2010

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



Re: Dialog Buttons - jameskmonger - 27.03.2010

Thanks, it worked!