Advertisement
macquid123560

Music Menu (1.0) by @.TheBomB`

Nov 3rd, 2018
1,040
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.57 KB | None | 0 0
  1. #define PREFIX "bombs"
  2.  
  3. #include <amxmodx>
  4.  
  5. enum _:enMusicData
  6. {
  7.     Name[ 32 ],
  8.     Location[ 64 ]
  9. }
  10.  
  11.  
  12. new szMusic[ ][ enMusicData ] =
  13. {
  14.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  15.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  16.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  17.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  18.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  19.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  20.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  21.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  22.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  23.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  24.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  25.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  26.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  27.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  28.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  29.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  30.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  31.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" },
  32.      { "*PUT_HERE_SONG_NAME*", "*PUT_HERE_MP3_LOCATION.mp3*" }
  33. }
  34.  
  35. new iVolume[ 33 ], iMusic[ 33 ];
  36.  
  37. new szText[ 128 ];
  38.  
  39. public plugin_init()
  40. {
  41.     register_plugin( "Music Menu", "1.0", "@.TheBomB`" )
  42.    
  43.     register_clcmd( "say /music", "MusicCmd" )
  44. }
  45.  
  46. public plugin_precache()
  47. {
  48.     for ( new i; i < sizeof szMusic; i++ )
  49.         precache_sound( szMusic[ i ][ Location ] )
  50. }
  51.  
  52. public client_putinserver( client )
  53. {  
  54.     client_cmd( client, "MP3Volume ^"1.0^"" );
  55.    
  56.     iMusic[ client ] = -1
  57. }
  58.  
  59. public MusicCmd( client )
  60. {
  61.     formatex( szText, charsmax( szText ), "\r[AMXX]\w Music Menu" )
  62.     new menu = menu_create( szText, "music_handler" )
  63.  
  64.     if( iMusic[ client ] == -1 )
  65.         formatex( szText, charsmax( szText ), "Song: \rNo Song Choosen^n^n\wVolume: \y%i%", iVolume[ client ] * 10  )
  66.    
  67.     else
  68.         formatex( szText, charsmax( szText ), "Song: \y%s^n^n\wVolume: \y%i%s", szMusic[ iMusic[ client ] ][ Name ] ,iVolume[ client ], iVolume[ client ] == 0 ? "%" : "0%" )
  69.    
  70.     menu_additem( menu, szText )
  71.    
  72.     menu_additem( menu, "Volume Up" )
  73.     menu_additem( menu, "Volume Down^n" )
  74.    
  75.     menu_additem( menu, "Start Song^n" )
  76.    
  77.     menu_display( client, menu )
  78.    
  79.     return PLUGIN_HANDLED;
  80. }
  81.  
  82. public music_handler( client, menu, item )
  83. {
  84.     if( item == MENU_EXIT )
  85.         return menu_destroy( menu )
  86.        
  87.     switch( item )
  88.     {
  89.         case 0:
  90.             return SongsList( client )
  91.            
  92.         case 1:
  93.         {
  94.             if( iVolume[ client ] != 10 )
  95.             {
  96.                 iVolume[ client ]++;
  97.                
  98.                 Volume( client );
  99.             }
  100.             return MusicCmd( client )
  101.         }
  102.        
  103.         case 2:
  104.         {
  105.             if ( iVolume[ client ] != 0 )
  106.             {
  107.                 iVolume[ client ]--;
  108.            
  109.                 Volume( client );
  110.             }
  111.             return MusicCmd( client );
  112.         }
  113.        
  114.         case 3:
  115.         {
  116.             if( iMusic[ client ] == -1 )
  117.             {
  118.                 ColorChat( client, "You have to choose a song" )
  119.                 return MusicCmd( client )
  120.             }
  121.                
  122.             client_cmd( client, "mp3 play ^"sound/%s^"", szMusic[ iMusic[ item ] ][ Location ] );
  123.             return ColorChat( client, "You have start the song ^4%s^1. volume:^4 %i%% ", szMusic[ iMusic[ client ] ][ Name ] ,iVolume[ client ] * 10 )
  124.         }
  125.                
  126.     }
  127.     return 0;
  128. }
  129.    
  130. public SongsList( client )
  131. {
  132.     formatex( szText, charsmax( szText ), "\r[AMXX]\w Music Menu | Songs List" )
  133.     new menu = menu_create( szText, "songlist_handler" )
  134.    
  135.     for( new i; i < sizeof szMusic; i++ )
  136.     {
  137.         formatex( szText, charsmax( szText ), "%s", szMusic[ i ][ Name ] )
  138.         menu_additem( menu, szText )
  139.     }
  140.    
  141.     menu_display( client, menu, 0 )
  142.    
  143.     return 0;
  144. }
  145.  
  146. public songlist_handler( client, menu, item )
  147. {
  148.     if( item == MENU_EXIT )
  149.     {
  150.         menu_destroy( menu )
  151.         return MusicCmd( client )
  152.     }
  153.        
  154.     iMusic[ client ] = item;
  155.    
  156.     return MusicCmd( client )
  157. }
  158.  
  159. stock Volume( client )
  160. {
  161.     client_cmd( client, "MP3Volume ^"%.1f^"", iVolume[ client ] / 10 );
  162. }
  163.  
  164. stock ColorChat( const index, const string[], any:... )
  165. {
  166.     new szMsg[ 191 ], Players[ 32 ], PNum = 1;
  167.    
  168.     static iLen; iLen = formatex( szMsg, charsmax( szMsg ), "^3[AMXX]^1 " );
  169.    
  170.     vformat( szMsg[ iLen ], charsmax( szMsg ) - iLen, string, 3 );
  171.    
  172.     if ( index )
  173.         Players[ 0 ] = index;
  174.    
  175.     else
  176.         get_players( Players, PNum, "ch" );
  177.    
  178.     for ( new i; i < PNum; i++ )
  179.     {
  180.         if( is_user_connected( Players[ i ] ) )
  181.         {
  182.             message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, Players[ i ] );
  183.            
  184.             write_byte( Players[ i ] );
  185.            
  186.             write_string( szMsg );
  187.            
  188.             message_end( );
  189.         }
  190.     }
  191.    
  192.     return 1;
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement