Advertisement
iXdoctor

Simple MainMenu

Aug 3rd, 2014
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.65 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include < amxmodx >
  4. #include < ColorChat >
  5.  
  6. #define szPrefix    "AMXX"
  7.  
  8. enum _: mData
  9. {
  10.     iMenu[ 32 ],
  11.     iMenuHandler[ 32 ],
  12.     iMenuMessage[ 64 ],
  13.     iMenuCommand[ 32 ]
  14. }
  15.  
  16. new MainCvar;
  17.  
  18. new const mMenusData [ ] [ mData ] =
  19. {
  20.     { "\rMenu\d #1", "MenuHandler1", "You have ^3enterd^1 to the Blabla #1 ^3Menu", "/help" },
  21.     { "\rMenu\d #2", "MenuHandler2", "You have ^3enterd^1 to the Blabla #2 ^3Menu", "/help1" },
  22.     { "\rMenu\d #3", "MenuHandler3", "You have ^3enterd^1 to the Blabla #3 ^3Menu", "/help2" },
  23.     { "\rMenu\d #4", "MenuHandler4", "You have ^3enterd^1 to the Blabla #4 ^3Menu", "/help3" }
  24. }
  25.  
  26. public plugin_init()
  27. {
  28.     register_plugin( "Simple Menu", "1.0", "Xdoctor" );
  29.    
  30.     register_clcmd( "say /menu", "CmdMenu" );
  31.    
  32.     MainCvar = register_cvar( "mainmenu_status", "0" ) // 0 == Menu // 1 == Command //
  33. }
  34.  
  35. public CmdMenu( client )
  36. {
  37.     new szText[ 128 ];
  38.    
  39.     formatex( szText, charsmax( szText ), "\d[ \y%s\d ]\r Main\y Help\w Menu:", szPrefix );
  40.    
  41.     new Menu = menu_create( szText, "CmdMainHandler" );
  42.    
  43.     for( new i; i < sizeof( mMenusData ); i++ )
  44.     {
  45.         formatex( szText, charsmax( szText ), "%s", mMenusData[ i ][ iMenu ] );
  46.        
  47.         menu_additem( Menu, szText );
  48.     }
  49.    
  50.     menu_display( client, Menu, 0 );
  51.    
  52.     return 1;
  53. }
  54.  
  55.  
  56. public CmdMainHandler( client, Menu, Item )
  57. {
  58.     if( Item == MENU_EXIT )
  59.     {
  60.         menu_destroy( Menu );
  61.        
  62.         return 1;
  63.     }
  64.    
  65.     ColorChat( client, RED, "%s", mMenusData[ Item ][ iMenuMessage ] );
  66.    
  67.     switch( MainCvar )
  68.     {
  69.         case 0: set_task( 0.5, mMenusData[ Item ][ iMenuHandler ] );
  70.         case 1: client_cmd( client, "say %s", mMenusData[ Item ][ iMenuCommand ] );
  71.     }
  72.    
  73.     return 1;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement