Advertisement
sseebbyy

Events (& examples) of Menu System

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