Want more features on Pastebin? Sign Up, it's FREE!
Guest

Guide to create dialogs.

By: a guest on Feb 22nd, 2012  |  syntax: PAWN  |  size: 1.90 KB  |  views: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <a_samp>
  2.  
  3. #define ListID 2501
  4. #define InputID 2502
  5. #define MessageID 2503
  6.  
  7. public OnPlayerCommandText(playerid, cmdtext[])
  8. {
  9.         if(!strcmp(cmdtext, "/list", true))
  10.         {
  11.             ShowPlayerDialog(playerid, ListID, DIALOG_STYLE_LIST,  "I'm learning the dialog list by ZiPoNz", "Send me two messages.\nGive me the weapon of this dialog.", "Select", "Cancel");
  12.                 return SendClientMessage(playerid, 0xFFFFFF00, "Please choose the option that you want to use.");
  13.         }
  14.         if(!strcmp(cmdtext, "/input", true))
  15.         {
  16.                 ShowPlayerDialog(playerid, InputID, DIALOG_STYLE_INPUT,  "I'm learning the dialog input by ZiPoNz", "Please write the text that you want to display for all.", "Continue", "Cancel");
  17.                 return SendClientMessage(playerid, 0xFFFFFF00, "Please write the text in the box.");
  18.         }
  19.  
  20.         if(!strcmp(cmdtext, "/message", true))
  21.         {
  22.                 ShowPlayerDialog(playerid, 2503, DIALOG_STYLE_MSGBOX,  "Did you learn something from this guide?", "Please choose the option.", "Like", "Dislike");
  23.                 return SendClientMessage(playerid, 0xFFFFFF00, "Please choose your opinion.");
  24.         }
  25.         return false;
  26. }
  27.  
  28. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  29. {
  30.         switch(dialogid)
  31.         {
  32.             case ListID:
  33.             {
  34.                 if(!response) return true;
  35.                 switch(listitem)
  36.                 {
  37.                     case 0: SendClientMessage(playerid, 0xFFFFFF00, "Message number: 1."), SendClientMessage(playerid, 0xFFFFFF00, "Message number: 2.");
  38.                 case 1: GivePlayerWeapon(playerid, 24, 50);
  39.                         }
  40.             }
  41.             case InputID:
  42.             {
  43.                         if(!response) return true;
  44.                         new string[128];
  45.                         format(string, 128, "%s", inputtext);
  46.                         SendClientMessageToAll(0xFFFFFF00, string);
  47.                 }
  48.                 case MessageID:
  49.                 {
  50.                     if(!response) return SendClientMessage(playerid, 0xFFFFFF00, "You chose the option: Dislike.");
  51.             SendClientMessage(playerid, 0xFFFFFF00, "You chose the option: Like!");
  52.         }
  53.         }
  54.        
  55.         return true;
  56. }
clone this paste RAW Paste Data