Advertisement
ISRaiyaN

Music Menu - New

Oct 27th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 11.88 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <colorchat>
  3.  
  4. #define HEB_SOUNDS 12 // כמה שירים בעברית
  5. #define ENG_SOUNDS 12 // כמה שירים באנגלית
  6.  
  7. #define MaxPlayers get_maxplayers()
  8.  
  9. new Prefix[] = "Fun"
  10.  
  11. new Text[ 200 ]
  12. new Song[ 200 ]
  13.  
  14. new Plugin[] = "Music Menu"
  15. new Version[] = "4.0"
  16. new Author[] = "ISRaiyaN"
  17.  
  18. new iVolume[ 200 ];
  19.  
  20. new bool:PlayForAll[ 200 ]
  21. new bool:BlockAdminPlay[ 200 ]
  22.  
  23. enum _: Heb
  24. {
  25.     NamesMusic[ 200 ],
  26.     Singer[ 200 ],
  27.     Play[ 200 ],
  28.     Time[ 200 ]
  29. }
  30.  
  31. enum _: Eng
  32. {
  33.     NamesMusic[ 200 ],
  34.     Singer[ 200 ],
  35.     Play[ 200 ],
  36.     Time[ 200 ]
  37. }
  38.  
  39. new const HebMusic[ HEB_SOUNDS ][ Heb ] =
  40. {
  41.     { "Heb Songs Name", "Music/Hebrew/SongsName.mp3" },
  42.     { "Heb Songs Name", "Music/Hebrew/SongsName.mp3" },
  43.     { "Heb Songs Name", "Music/Hebrew/SongsName.mp3" },
  44.     { "Heb Songs Name", "Music/Hebrew/SongsName.mp3" },
  45.     { "Heb Songs Name", "Music/Hebrew/SongsName.mp3" },
  46.     { "Heb Songs Name", "Music/Hebrew/SongsName.mp3" },
  47.     { "Heb Songs Name", "Music/Hebrew/SongsName.mp3" },
  48.     { "Heb Songs Name", "Music/Hebrew/SongsName.mp3" },
  49.     { "Heb Songs Name", "Music/Hebrew/SongsName.mp3" },
  50.     { "Heb Songs Name", "Music/Hebrew/SongsName.mp3" },
  51.     { "Heb Songs Name", "Music/Hebrew/SongsName.mp3" },
  52.     { "Heb Songs Name", "Music/Hebrew/SongsName.mp3" }
  53. }
  54.  
  55. new const EngMusic[ ENG_SOUNDS ][ Eng ] =
  56. {
  57.     { "Eng Songs Name", "Music/English/SongsName.mp3" },
  58.     { "Eng Songs Name", "Music/English/SongsName.mp3" },
  59.     { "Eng Songs Name", "Music/English/SongsName.mp3" },
  60.     { "Eng Songs Name", "Music/English/SongsName.mp3" },
  61.     { "Eng Songs Name", "Music/English/SongsName.mp3" },
  62.     { "Eng Songs Name", "Music/English/SongsName.mp3" },
  63.     { "Eng Songs Name", "Music/English/SongsName.mp3" },
  64.     { "Eng Songs Name", "Music/English/SongsName.mp3" },
  65.     { "Eng Songs Name", "Music/English/SongsName.mp3" },
  66.     { "Eng Songs Name", "Music/English/SongsName.mp3" },
  67.     { "Eng Songs Name", "Music/English/SongsName.mp3" },
  68.     { "Eng Songs Name", "Music/English/SongsName.mp3" }
  69. }
  70.  
  71. public plugin_precache()
  72. {
  73.     for( new i; i < ENG_SOUNDS; i++ )
  74.     precache_sound( EngMusic[ i ][ Play ] )
  75.    
  76.     for( new i; i < HEB_SOUNDS; i++ )
  77.     precache_sound( HebMusic[ i ][ Play ] )
  78. }
  79.  
  80. public plugin_init() {
  81.     register_plugin( Plugin, Version, Author)
  82.    
  83.     register_clcmd("say /music", "MusicMenu")
  84.     register_clcmd("say /sm", "StopMusic")
  85.     register_clcmd("say /stop", "StopMusic")
  86.     register_clcmd("say /stopmusic", "StopMusic")
  87. }
  88.  
  89. public client_putinserver( id )
  90. {
  91.     client_cmd( id, "MP3Volume ^"1.0^"" );
  92.        
  93.     Song[ id ] = 0;
  94.    
  95.     iVolume[id] = 100
  96.    
  97.     PlayForAll[id] = false
  98.    
  99.     BlockAdminPlay[id] = true
  100. }
  101.  
  102. public StopMusic(id)
  103. {
  104.     client_cmd(id, "mp3 stop")
  105.     ColorChat(id, RED, "^4[ ^3%s ^4] ^1You have ^3Stopped ^1your ^4Music.", Prefix )
  106.    
  107.     return 1;
  108. }
  109.  
  110. public MusicMenu(id)
  111. {
  112.     formatex( Text, charsmax( Text ), "\r[ \d%s \r] \yMusic Menu \dBy \w%s^n^n\r- \dPlaying For: %s^n\r- \dBlock Admin: %s^n\r- \dVolume: \y%d%", Prefix, Author,
  113.     PlayForAll[id] ? "\yAll Players" : "\rYourself", BlockAdminPlay[id] ? "\yEnabled" : "\rDisabled", iVolume[id])
  114.     new MMenu = menu_create( Text, "Music_Handler")
  115.    
  116.     menu_additem( MMenu, "English Music \rMenu" )
  117.     menu_additem( MMenu, "Hebrew Music \rMenu^n" )
  118.     menu_additem( MMenu, "Stop \yMusic^n" )
  119.     menu_additem( MMenu, "Volume \rMenu^n" )
  120.     menu_additem( MMenu, "Random \yEnglish Music" )
  121.     menu_additem( MMenu, "Random \yHebrew Music^n" )
  122.     menu_additem( MMenu, "Block Admin Music^n\r- \dit blocks when admin play music^n\r- \dfor all players on the server^n" )
  123.    
  124.     if( (get_user_flags(id) & ADMIN_KICK) )
  125.     {
  126.         menu_additem( MMenu, "Playing For: \yAll Players\r/\yYourself^n^n" )
  127.         menu_additem( MMenu, "\yExit" )
  128.     }
  129.    
  130.    
  131.     menu_setprop(MMenu, MPROP_EXIT, MEXIT_ALL )
  132.    
  133.     if( (get_user_flags(id) & ADMIN_KICK) )
  134.     {
  135.     menu_setprop(MMenu, MPROP_PERPAGE, 0 )
  136.     }
  137.    
  138.     menu_setprop(MMenu, MPROP_EXITNAME, "\yExit")
  139.     menu_setprop(MMenu, MPROP_NUMBER_COLOR, "\r" )
  140.  
  141.     menu_display(id, MMenu, 0);
  142.  
  143.     return 1;
  144. }
  145.  
  146. public Music_Handler(id, MMenu, item)
  147. {
  148.     switch( item )
  149.     {
  150.         case 0:
  151.         {
  152.             EngMusicMenu(id)
  153.         }
  154.        
  155.         case 1:
  156.         {
  157.             HebMusicMenu(id)
  158.         }
  159.        
  160.         case 2:
  161.         {
  162.             client_cmd(id, "mp3 stop")
  163.             ColorChat(id, RED, "^4[ ^3%s ^4] ^1You have ^3Stopped ^1your ^4Music.", Prefix )
  164.             MusicMenu(id)
  165.         }
  166.        
  167.         case 3:
  168.         {
  169.             VolumeMenu(id)
  170.         }
  171.        
  172.         case 6:
  173.         {
  174.             BlockAdminPlay[id] = !BlockAdminPlay[id]
  175.             ColorChat(id, RED, "^4[ ^3%s ^4] ^1You have ^3%s ^1block admin music.", Prefix, BlockAdminPlay[id] ? "Enabled" : "Disabled" )
  176.             MusicMenu(id)
  177.         }
  178.        
  179.         case 4:
  180.         {
  181.             new RandomEng = random_num( 1, ENG_SOUNDS )
  182.                
  183.             client_cmd(id, "mp3 play ^"sound/%s^"", EngMusic[ RandomEng ][ Play ] )
  184.             ColorChat(id, RED, "^4[ ^3%s ^4] ^1You have ^3Received ^1the ^4Song: ^3%s", Prefix, EngMusic[ RandomEng ][ NamesMusic ])
  185.            
  186.             MusicMenu(id)
  187.         }
  188.         case 5:
  189.         {
  190.             new RandomHeb = random_num( 1, HEB_SOUNDS )
  191.                
  192.             client_cmd(id, "mp3 play ^"sound/%s^"", HebMusic[ RandomHeb ][ Play ] )
  193.             ColorChat(id, RED, "^4[ ^3%s ^4] ^1You have ^3Received ^1the ^4Song: ^3%s", Prefix, HebMusic[ RandomHeb ][ NamesMusic ])
  194.            
  195.             MusicMenu(id)
  196.         }
  197.        
  198.         case 7:
  199.         {
  200.             PlayForAll[id] = !PlayForAll[id]
  201.             MusicMenu(id)
  202.         }
  203.     }
  204. }
  205.  
  206. public EngMusicMenu(id)
  207. {  
  208.     formatex( Text, charsmax( Text ), "\r[ \d%s \r] \yEnglish Music Menu", Prefix)
  209.     new EngMenu = menu_create( Text, "Eng_Handler")
  210.        
  211.     for( new i; i < sizeof EngMusic; i++ )
  212.     {
  213.         formatex( Text, charsmax( Text ), "\w%s", EngMusic[ i ][ NamesMusic ] )
  214.         menu_additem( EngMenu, Text )
  215.     }
  216.     menu_setprop(EngMenu, MPROP_EXIT, MEXIT_ALL );
  217.     menu_setprop(EngMenu, MPROP_EXITNAME, "\yBack To Music Menu" )
  218.     menu_setprop(EngMenu, MPROP_NUMBER_COLOR, "\r" )
  219.  
  220.     menu_display(id, EngMenu, 0);
  221.  
  222.     return ;
  223. }
  224.  
  225. public Eng_Handler(id, EngMenu, item)
  226. {
  227.     if ( item == MENU_EXIT )
  228.     {
  229.         menu_destroy( EngMenu );
  230.         MusicMenu( id );
  231.     }
  232.     Song[ id ] = item
  233.    
  234.     EngSongInfo(id, item)
  235. }      
  236.        
  237. public HebMusicMenu(id)
  238. {
  239.     formatex( Text, charsmax( Text ), "\r[ \d%s \r] \yHebrew Music Menu", Prefix)
  240.     new HebMenu = menu_create( Text, "Heb_Handler")
  241.        
  242.     for( new i; i < sizeof HebMusic; i++ )
  243.     {
  244.         formatex( Text, charsmax( Text ), "\w%s", HebMusic[ i ][ NamesMusic ] )
  245.         menu_additem( HebMenu, Text )
  246.     }
  247.        
  248.     menu_setprop(HebMenu, MPROP_EXIT, MEXIT_ALL );
  249.     menu_setprop(HebMenu, MPROP_EXITNAME, "\yBack To Music Menu" )
  250.     menu_setprop(HebMenu, MPROP_NUMBER_COLOR, "\r" )
  251.  
  252.     menu_display(id, HebMenu, 0);
  253.  
  254.     return ;
  255. }
  256. public Heb_Handler(id, HebMenu, item)
  257. {
  258.     if ( item == MENU_EXIT )
  259.     {
  260.         menu_destroy( HebMenu );
  261.         MusicMenu( id );
  262.     }
  263.     Song[ id ] = item
  264.    
  265.     HebSongInfo(id, item)
  266. }
  267.  
  268. public VolumeMenu(id)
  269. {
  270.     formatex( Text, charsmax( Text ), "\r[ \d%s \r] \yVolume Menu^n\y- \dChoose Your Volume You Want^n\dVolume: \y%d%", Prefix, iVolume[id])
  271.     new VolMenu = menu_create( Text, "Volume_Handler")
  272.    
  273.     menu_additem( VolMenu, "Volume: \y100%" )
  274.     menu_additem( VolMenu, "Volume: \y80%" )
  275.     menu_additem( VolMenu, "Volume: \y60%" )
  276.     menu_additem( VolMenu, "Volume: \y40%" )
  277.     menu_additem( VolMenu, "Volume: \y20%" )
  278.     menu_additem( VolMenu, "Volume: \y0%" )
  279.    
  280.     menu_setprop(VolMenu, MPROP_EXIT, MEXIT_ALL );
  281.     menu_setprop(VolMenu, MPROP_EXITNAME, "\yBack" )
  282.     menu_setprop(VolMenu, MPROP_NUMBER_COLOR, "\r" )
  283.  
  284.     menu_display(id, VolMenu, 0);
  285.    
  286.     return ;
  287. }
  288. public Volume_Handler(id, VolMenu, item)
  289. {
  290.     if ( item == MENU_EXIT )
  291.     {
  292.         menu_destroy( VolMenu );
  293.         MusicMenu( id );
  294.    
  295.     }  
  296.     switch( item )
  297.     {
  298.         case 0:
  299.         {
  300.             iVolume[id] = 100
  301.             client_cmd(id, "MP3Volume ^"1.0^"" )
  302.             ColorChat(id, RED, "^4[ ^3%s ^4] ^1Your ^3Volume ^1now:^4 100% ^1( ^3Max Volume ^1)", Prefix )
  303.             VolumeMenu(id)
  304.         }
  305.         case 1:
  306.         {
  307.             iVolume[id] = 80
  308.             client_cmd(id, "MP3Volume ^"0.8^"" )
  309.             ColorChat(id, RED, "^4[ ^3%s ^4] ^1Your ^3Volume ^1now:^4 80%", Prefix )
  310.             VolumeMenu(id)
  311.         }
  312.         case 2:
  313.         {
  314.             iVolume[id] = 60
  315.             client_cmd(id, "MP3Volume ^"0.6^"" )
  316.             ColorChat(id, RED, "^4[ ^3%s ^4] ^1Your ^3Volume ^1now:^4 60%", Prefix )
  317.             VolumeMenu(id)
  318.         }
  319.         case 3:
  320.         {
  321.             iVolume[id] = 40;
  322.             client_cmd(id, "MP3Volume ^"0.4^"" )
  323.             ColorChat(id, RED, "^4[ ^3%s ^4] ^1Your ^3Volume ^1now:^4 40%", Prefix )
  324.             VolumeMenu(id)
  325.         }
  326.         case 4:
  327.         {
  328.             iVolume[id] = 20;
  329.             client_cmd(id, "MP3Volume ^"0.2^"" )
  330.             ColorChat(id, RED, "^4[ ^3%s ^4] ^1Your ^3Volume ^1now:^4 20%", Prefix )
  331.             VolumeMenu(id)
  332.         }
  333.         case 5:
  334.         {
  335.             iVolume[id] = 0;
  336.             client_cmd(id, "MP3Volume ^"0.0^"" )
  337.             ColorChat(id, RED, "^4[ ^3%s ^4] ^1Your ^3Volume ^1now:^4 0%", Prefix )
  338.             VolumeMenu(id)
  339.         }
  340.     }
  341. }
  342.  
  343. public HebSongInfo(id, item)
  344. {
  345.     formatex( Text, charsmax( Text ), "\r[ \d%s \r] ^n\r- \dSong Info:^n\y-----------------^n\r- \dSong Name: \y%s^n\r- \dSinger Name: \y%s^n\r- \dSong Time: \y%s^n", Prefix, HebMusic[ item ][ NamesMusic ],HebMusic[ item ][ Singer ], HebMusic[ item ][ Time ])
  346.    
  347.     new HebMenu = menu_create( Text, "Heb_Info" )
  348.  
  349.     menu_additem( HebMenu, "\d- \rPlay Song \d-" )
  350.    
  351.     menu_setprop(HebMenu, MPROP_EXIT, MEXIT_ALL );
  352.     menu_setprop(HebMenu, MPROP_EXITNAME, "\yBack" )
  353.     menu_setprop(HebMenu, MPROP_NUMBER_COLOR, "\r" )
  354.    
  355.     menu_display( id, HebMenu, 0 )
  356. }
  357.  
  358. public Heb_Info(id, HebMenu, item)
  359. {
  360.     if ( item == MENU_EXIT )
  361.     {
  362.         menu_destroy( HebMenu )
  363.         HebMusicMenu( id )
  364.     }
  365.     switch( item )
  366.     {
  367.         case 0:
  368.         {
  369.             if(! PlayForAll[id] )
  370.             {
  371.                 client_cmd(id, "mp3 play ^"sound/%s^"", HebMusic[ Song[id]][ Play ] )
  372.                 ColorChat(id, RED, "^4[ ^3%s ^4] ^1You have ^3Started ^1the ^4Song: ^3%s", Prefix, HebMusic[ Song[id]][ NamesMusic ])
  373.             }
  374.             for ( new i = 1; i < MaxPlayers; i++ )
  375.             {
  376.                 if( PlayForAll[id] )
  377.                 if(! BlockAdminPlay[i] )
  378.                 {
  379.                     new AdminName[ 32 ];
  380.                     get_user_name( id, AdminName, charsmax( AdminName ) );
  381.    
  382.                     client_cmd(id, "mp3 play ^"sound/%s^"", HebMusic[ Song[id]][ Play ] )
  383.                     client_cmd(i, "mp3 play ^"sound/%s^"", HebMusic[ Song[id]][ Play ] )
  384.                     ColorChat(i, RED, "^4[ ^3%s ^4] ^1ADMIN: ^3%s ^1Started the ^4Song: ^3%s", Prefix, AdminName, HebMusic[ Song[id]][ NamesMusic ])
  385.                 }
  386.                 else if( BlockAdminPlay[id] )
  387.                 {
  388.                     ColorChat(id, RED, "^4[ ^3%s ^4] ^1You have play to all players the ^4Song: ^3%s", Prefix, HebMusic[ Song[id]][ NamesMusic ])
  389.                 }
  390.             }
  391.         }
  392.     }
  393.     menu_destroy( HebMenu )
  394. }
  395.  
  396. public EngSongInfo(id, item)
  397. {
  398.     formatex( Text, charsmax( Text ), "\r[ \d%s \r] ^n\r- \dSong Info:^n\y-----------------^n\r- \dSong Name: \y%s^n\r- \dSinger Name: \y%s^n\r- \dSong Time: \y%s^n", Prefix, EngMusic[ item ][ NamesMusic ],EngMusic[ item ][ Singer ], EngMusic[ item ][ Time ])
  399.    
  400.     new EngMenu = menu_create( Text, "Eng_Info" )
  401.  
  402.     menu_additem( EngMenu, "\d- \rPlay Song \d-" )
  403.    
  404.     menu_setprop(EngMenu, MPROP_EXIT, MEXIT_ALL );
  405.     menu_setprop(EngMenu, MPROP_EXITNAME, "\yBack" )
  406.     menu_setprop(EngMenu, MPROP_NUMBER_COLOR, "\r" )
  407.    
  408.     menu_display( id, EngMenu, 0 )
  409. }
  410.  
  411. public Eng_Info(id, EngMenu, item)
  412. {
  413.     if ( item == MENU_EXIT )
  414.     {
  415.         menu_destroy( EngMenu );
  416.         EngMusicMenu( id );
  417.     }
  418.     switch( item )
  419.     {
  420.         case 0:
  421.         {
  422.             if(! PlayForAll[id] )
  423.             {
  424.                 client_cmd(id, "mp3 play ^"sound/%s^"", EngMusic[ Song[id]][ Play ] )
  425.                 ColorChat(id, RED, "^4[ ^3%s ^4] ^1You have ^3Started ^1the ^4Song: ^3%s", Prefix, EngMusic[ Song[id]][ NamesMusic ])
  426.             }
  427.             for ( new i = 1; i < MaxPlayers; i++ )
  428.             {
  429.                 if( PlayForAll[id] )
  430.                 if(! BlockAdminPlay[i] )
  431.                 {
  432.                     new AdminName[ 32 ];
  433.                     get_user_name( id, AdminName, charsmax( AdminName ) );
  434.    
  435.                     client_cmd(i, "mp3 play ^"sound/%s^"", EngMusic[ Song[id]][ Play ] )
  436.                     client_cmd(id, "mp3 play ^"sound/%s^"", EngMusic[ Song[id]][ Play ] )
  437.                     ColorChat(i, RED, "^4[ ^3%s ^4] ^1ADMIN: ^3%s ^1Started the ^4Song: ^3%s", Prefix, AdminName, EngMusic[ Song[id]][ NamesMusic ])
  438.                 }
  439.                 else if( BlockAdminPlay[id] )
  440.                 {
  441.                     ColorChat(id, RED, "^4[ ^3%s ^4] ^1You have play to all players the ^4Song: ^3%s", Prefix, EngMusic[ Song[id]][ NamesMusic ])
  442.                 }
  443.             }
  444.         }
  445.     }
  446.     menu_destroy( EngMenu )
  447. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement