Advertisement
sseebbyy

events of Dialog System

Sep 17th, 2014
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.49 KB | None | 0 0
  1. --------------------------------------------------------------------------
  2. // EXAMPLE FOR CHOOSED OPTION THAT HAS NO SUBMENU
  3. --------------------------------------------------------------------------
  4.  
  5. function onPlayerDialog(player, dialogid, option)
  6. {
  7.     switch(dialogid) // dialog ID - it starts with 0
  8.     {
  9.         case 0: // first dialog/menu created
  10.                 switch(option) // we are switching options now
  11.                 {
  12.                     case 1: // this means the first option from dialog/menu 0
  13.                             MessagePlayer("// code here for option 1 in dialog 0",player);
  14.                         break;
  15.                     case 2: // option 2
  16.                             // here script the code for the option2, when it is selected.
  17.                         break;
  18.                 default: break;
  19.                 }
  20.         break;
  21.         default: break;
  22.     }
  23. }
  24.  
  25. --------------------------------------------------------------------------
  26. // EXAMPLE FOR CHOOSED OPTION THAT ACTUALLY HAS A SUBMENU
  27. --------------------------------------------------------------------------
  28.  
  29. function onPlayerSubDialog(player, subdialogid, option)
  30. {
  31.     switch(subdialogid) // the ID of the selected option in main menu
  32.     {
  33.         case 1: // it starts with ID 1, and not with 0
  34.             switch(option)
  35.             {
  36.                 case 1: // the ID of the selected option in the sub menu - it also starts with ID 0
  37.                     MessagePlayer("You choosed the option 1 of the submenu with ID 1",player);
  38.                     break;
  39.                 case 2:
  40.                     MessagePlayer("// code here for the choosed option 2 of the submenu with ID 1",player);
  41.                     break;
  42.                 default: break;
  43.             }
  44.             break;
  45.         default: break;
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement