Advertisement
RanAway

[ Pawn ] Advanced music menu

Jul 20th, 2022 (edited)
2,123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 20.80 KB | None | 0 0
  1. /************** Includes **************/
  2. #include < amxmodx >
  3. #include < amxmisc >
  4. #include < dhudmessage >
  5.  
  6. /************** Defines **************/
  7. #define Prefix "AMXX"
  8.  
  9. // config text
  10. #define EnglishCfg "addons/amxmodx/configs/music/english.txt"
  11. #define HiphopCfg "addons/amxmodx/configs/music/hiphop.txt"
  12. #define TranceCfg "addons/amxmodx/configs/music/trance.txt"
  13. #define DubstepCfg "addons/amxmodx/configs/music/dubstep.txt"
  14.  
  15. #define EnglishFolder "music/english/"
  16. #define HiphopFolder "music/hiphop/"
  17. #define TranceFolder "music/trance/"
  18. #define DubstepFolder "music/dubstep/"
  19.  
  20. #define folder "addons/amxmodx/configs/music"
  21.  
  22. /************** News **************/
  23. // Vol stuff
  24. new const Volume[] [] =
  25. {
  26.     "[\r----------\w]",
  27.     "[\y+\r---------\w]",
  28.     "[\y++\r--------\w]",
  29.     "[\y+++\r-------\w]",
  30.     "[\y++++\r------\w]",
  31.     "[\y+++++\r-----\w]",
  32.     "[\y++++++\r----\w]",
  33.     "[\y+++++++\r---\w]",
  34.     "[\y++++++++\r--\w]",
  35.     "[\y+++++++++\r-\w]",
  36.     "[\y++++++++++\w]"
  37. }
  38.  
  39. new VolumeCTRL[ 33 ]
  40. new Float: Mp3value[ 33 ]
  41.  
  42. // ini items
  43. enum _:SongProperties
  44. {
  45.     SongName[ 31 ],
  46.     SongTime[ 31 ],
  47.     SongAuthor[ 31 ],
  48.     SongFile[ 120 ]
  49. }
  50.  
  51. // English Stuff
  52. new EnglishSongs[ 120 ][ SongProperties ], EnglishLoaded = 0
  53.  
  54. // Hiphop Stuff
  55. new HiphopSongs[ 120 ][ SongProperties ], HiphopLoaded = 0
  56.  
  57. // Trance Stuff
  58. new TranceSongs[ 120 ][ SongProperties ], TranceLoaded = 0
  59.  
  60. // Dubstep Stuff
  61. new DubstepSongs[ 120 ][ SongProperties ], DubstepLoaded = 0
  62.  
  63. // view menu
  64. new ViewName[ 31 ], ViewTime[ 31 ], ViewAuthor[ 31 ], ViewFile[ 120 ]
  65.  
  66. // play all
  67. new PlayAll[ 33 ]
  68.  
  69. // Block admin
  70. new bool: BlockAdmin[ 33 ]
  71.  
  72. // Replay
  73. new bool: ReplayChoose[ 33 ]
  74.  
  75. // stuff
  76. new RandomStop[ 33 ], Category[ 33 ] = 0
  77.  
  78. public plugin_init()
  79. {
  80.     register_plugin( "Advanced Music Menu", "v1.0", "RanAway" )
  81.    
  82.     // clcmd
  83.     register_clcmd( "say /music", "MusicMenu" )
  84.     register_clcmd( "say /stop", "Stopsound" )
  85.     register_clcmd( "say /replay", "Replay" )
  86.    
  87.     // sub_menu
  88.     register_menucmd( register_menuid( "menu_music" ), 1023, "sub_music" )
  89.     register_menucmd( register_menuid( "OptionsMenu" ), 1023, "Option")
  90.    
  91.     // open folder
  92.     if( !dir_exists( folder ) )
  93.         mkdir( folder )
  94. }
  95.  
  96. /************** plugin_precache **************/
  97. public plugin_precache()
  98. {
  99.     LoadEnglish()
  100.     LoadHiphop()
  101.     LoadTrance()
  102.     LoadDubstep()
  103.    
  104.     new szItem[ 256 ]
  105.    
  106.     for (new i = 0; i < EnglishLoaded; i++)
  107.     {
  108.         formatex( szItem, charsmax( szItem ), "sound/%s%s", EnglishFolder, EnglishSongs[ i ][ SongFile ] )
  109.         precache_generic( szItem )
  110.     }
  111.    
  112.     for (new i = 0; i < HiphopLoaded; i++)
  113.     {
  114.         formatex( szItem, charsmax( szItem ), "sound/%s%s", HiphopFolder, HiphopSongs[ i ][ SongFile ] )
  115.         precache_generic( szItem )
  116.     }
  117.    
  118.     for (new i = 0; i < TranceLoaded; i++)
  119.     {
  120.         formatex( szItem, charsmax( szItem ), "sound/%s%s", TranceFolder, TranceSongs[ i ][ SongFile ] )
  121.         precache_generic( szItem )
  122.     }
  123.    
  124.     for (new i = 0; i < DubstepLoaded; i++)
  125.     {
  126.         formatex( szItem, charsmax( szItem ), "sound/%s%s", DubstepFolder, DubstepSongs[ i ][ SongFile ] )
  127.         precache_generic( szItem )
  128.     }
  129. }
  130.  
  131. /************** connect **************/
  132. public client_putinserver( id )
  133. {
  134.     PlayAll[ id ] = false
  135.     RandomStop[ id ] = false
  136.     BlockAdmin[ id ] = false
  137.     ReplayChoose[ id ] = false
  138.    
  139.     Mp3value[ id ] = 0.60
  140.     VolumeCTRL[ id ] = 6
  141.    
  142.     Category[ id ] = 0
  143. }
  144.  
  145. /************** Music menu **************/
  146. public MusicMenu( id )
  147. {
  148.     new szMenu[ 250 ], len, key = MENU_KEY_6|MENU_KEY_9|MENU_KEY_0
  149.    
  150.     len = format( szMenu[ len ], charsmax( szMenu ) - len, "\r[\w %s \r]\w Music menu^n^n", Prefix )
  151.    
  152.     if( EnglishLoaded == 0 )
  153.         len += format( szMenu[ len ], charsmax( szMenu) - len, "\d1. \wEnglish^n" )
  154.     else
  155.     {
  156.         key = MENU_KEY_1
  157.         len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r1. \wEnglish^n" )
  158.     }
  159.    
  160.     if( HiphopLoaded == 0 )
  161.         len += format( szMenu[ len ], charsmax( szMenu) - len, "\d2. \wHiphop^n" )
  162.     else
  163.     {
  164.         key = MENU_KEY_2
  165.         len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r2. \wHiphop^n" )
  166.     }
  167.    
  168.     if( TranceLoaded == 0 )
  169.         len += format( szMenu[ len ], charsmax( szMenu) - len, "\d3. \wTrance^n" )
  170.     else
  171.     {
  172.         key = MENU_KEY_3
  173.         len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r3. \wTrance^n" )
  174.     }
  175.    
  176.     if( DubstepLoaded == 0 )
  177.         len += format( szMenu[ len ], charsmax( szMenu) - len, "\d4. \wDubstep^n^n" )
  178.     else
  179.     {
  180.         key = MENU_KEY_4
  181.         len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r4. \wDubstep^n^n" )
  182.     }
  183.    
  184.     len += format( szMenu[ len ], charsmax( szMenu ) - len, "\y--------------------^n" )
  185.    
  186.     if( EnglishLoaded == 0 && HiphopLoaded == 0 && TranceLoaded == 0 && DubstepLoaded == 0 )
  187.         len += format( szMenu[ len ], charsmax( szMenu) - len, "\d5. \wRandom Music^n" )
  188.     else
  189.     {
  190.         key = MENU_KEY_5
  191.         len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r5. %s^n", RandomStop[ id ] ? "\rStopMusic\w" : "\yRandom Music\w")
  192.     }
  193.    
  194.     len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r6. \yVol. \w%s^n", Volume[ VolumeCTRL[ id ] ] )
  195.     len += format( szMenu[ len ], charsmax( szMenu ) - len, "\y--------------------^n^n" )
  196.    
  197.     len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r9. \wOptions Menu^n^n" )
  198.     len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r0. \wExit" )
  199.    
  200.     show_menu( id, key, szMenu, -1, "menu_music" )
  201.     return 1
  202. }
  203.  
  204. public sub_music( id, item )
  205. {
  206.     if( item == MENU_EXIT ) return 1
  207.    
  208.     if( item == 0 ) Category[ id ] = 1, CategoryMenu( id )
  209.     if( item == 1 ) Category[ id ] = 2, CategoryMenu( id )
  210.     if( item == 2 ) Category[ id ] = 3, CategoryMenu( id )
  211.     if( item == 3 ) Category[ id ] = 4, CategoryMenu( id )
  212.     if( item == 4 )
  213.     {
  214.         ReplayChoose[ id ] = true
  215.         RandomStop[ id ] = !RandomStop[ id ]
  216.        
  217.         if( RandomStop[ id ] )
  218.         {
  219.             for( new i = 1; i < get_maxplayers(); i++ )
  220.             {
  221.                 if( BlockAdmin[ i ] )
  222.                     continue
  223.                
  224.                 if( PlayAll[ id ] )
  225.                 {
  226.                     set_dhudmessage( 97, 97, 97, -1.0, 0.12, 0, 6.0, 8.0 )
  227.                     show_dhudmessage( i, "Admin %s has started ^"%s^" song^n enjoy", GetName( id ), ViewName )
  228.                    
  229.                     ReplayChoose[ i ] = true
  230.                     RandomStop[ i ] = true
  231.                    
  232.                     client_cmd( i, "mp3 play ^"%s^"", ViewFile )
  233.                     client_cmd( i, "MP3Volume %.1f", Mp3value[ i ] )
  234.                 }
  235.             }
  236.            
  237.             new randommusic = random_num( 1,4 )
  238.            
  239.             if( randommusic == 1 ) 
  240.             {
  241.                 new english = random_num( 0, sizeof EnglishLoaded )
  242.                 copy( ViewName, sizeof( ViewName ), EnglishSongs[ english ][ SongName ] )
  243.                 formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", EnglishFolder, EnglishSongs[ english ][ SongFile ] )
  244.             }
  245.            
  246.             if( randommusic == 2 )
  247.             {
  248.                 new hiphop = random_num( 0, sizeof HiphopLoaded )
  249.                 copy( ViewName, sizeof( ViewName ), HiphopSongs[ hiphop ][ SongName ] )
  250.                 formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", HiphopFolder, HiphopSongs[ hiphop ][ SongFile ] )
  251.             }
  252.            
  253.             if( randommusic == 3 )
  254.             {
  255.                 new trance = random_num( 0, sizeof TranceLoaded )
  256.                 copy( ViewName, sizeof( ViewName ), TranceSongs[ trance ][ SongName ] )
  257.                 formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", TranceFolder, TranceSongs[ trance ][ SongFile ] )
  258.             }
  259.            
  260.             if( randommusic == 4 ) 
  261.             {
  262.                 new dubstep = random_num( 0, sizeof DubstepLoaded )
  263.                 copy( ViewName, sizeof( ViewName ), DubstepSongs[ dubstep ][ SongName ] )
  264.                 formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", DubstepFolder, DubstepSongs[ dubstep ][ SongFile ] )
  265.             }
  266.            
  267.             ColorChat( id, "Enjoy listening to ^3%s^1 song", ViewName )
  268.             client_cmd( id, "mp3 play ^"%s^"", ViewFile )
  269.             client_cmd( id, "MP3Volume %.1f", Mp3value[ id ] )
  270.         }
  271.         else
  272.             Stopsound( id )
  273.        
  274.         MusicMenu( id )
  275.     }
  276.    
  277.     if( item == 5 )
  278.     {
  279.         if( Mp3value[ id ] > 1.00 )
  280.             Mp3value[ id ] = 0.0
  281.         else
  282.             Mp3value[ id ] += 0.10
  283.        
  284.         if( VolumeCTRL[ id ] == sizeof Volume - 1 )
  285.             VolumeCTRL[ id ] = 0
  286.         else
  287.             VolumeCTRL[ id ]++
  288.        
  289.         client_cmd( id, "MP3Volume %.1f", Mp3value[ id ] )
  290.         MusicMenu( id )
  291.     }
  292.    
  293.     if( item == 8 ) Options( id )
  294.    
  295.     return 1
  296. }
  297.  
  298. /************** Category Menu **************/
  299. public CategoryMenu( id )
  300. {
  301.     new szMenu[ 250 ], szSong[ 250 ]
  302.    
  303.     if( Category[ id ] == 1 ) formatex( szMenu, charsmax( szMenu ), "\r[\w %s \r]\w English Menu\R", Prefix )
  304.     if( Category[ id ] == 2 ) formatex( szMenu, charsmax( szMenu ), "\r[\w %s \r]\w Hiphop Menu\R", Prefix )
  305.     if( Category[ id ] == 3 ) formatex( szMenu, charsmax( szMenu ), "\r[\w %s \r]\w Trance Menu\R", Prefix )
  306.     if( Category[ id ] == 4 ) formatex( szMenu, charsmax( szMenu ), "\r[\w %s \r]\w Dubstep Menu\R", Prefix )
  307.    
  308.     new menu = menu_create( szMenu, "sub_category" )
  309.    
  310.     if( Category[ id ] == 1 )
  311.         for( new i = 0; i < EnglishLoaded; ++i )
  312.             formatex( szSong, charsmax( szSong ), "%s", EnglishSongs[ i ][ SongName ] )
  313.    
  314.     if( Category[ id ] == 2 )
  315.         for( new i = 0; i < HiphopLoaded; ++i )
  316.             formatex( szSong, charsmax( szSong ), "%s", HiphopSongs[ i ][ SongName ] )
  317.    
  318.     if( Category[ id ] == 3 )
  319.         for( new i = 0; i < TranceLoaded; ++i )
  320.             formatex( szSong, charsmax( szSong ), "%s", TranceSongs[ i ][ SongName ] )
  321.    
  322.     if( Category[ id ] == 4 )
  323.         for( new i = 0; i < DubstepLoaded; ++i )
  324.             formatex( szSong, charsmax( szSong ), "%s", DubstepSongs[ i ][ SongName ] )
  325.    
  326.     menu_additem( menu, szSong )
  327.    
  328.     menu_setprop( menu, MPROP_BACKNAME, "Previous Page" )
  329.     menu_setprop( menu, MPROP_NEXTNAME, "Next Page" )
  330.     menu_setprop( menu, MPROP_EXITNAME, "Back" )
  331.     menu_display( id, menu )
  332.    
  333.     return 1
  334. }
  335.  
  336. public sub_category( id, menu, item )
  337. {
  338.     if( item == MENU_EXIT )
  339.         return MusicMenu( id )
  340.    
  341.     if( Category[ id ] == 1 )
  342.     {
  343.         copy( ViewName, sizeof( ViewName ), EnglishSongs[ item ][ SongName ] )
  344.         copy( ViewTime, sizeof( ViewTime ), EnglishSongs[ item ][ SongTime ] )
  345.         copy( ViewAuthor, sizeof( ViewAuthor ), EnglishSongs[ item ][ SongAuthor ] )
  346.         formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", EnglishFolder, EnglishSongs[ item ][ SongFile ] )
  347.     }
  348.    
  349.     if( Category[ id ] == 2 )
  350.     {
  351.         copy( ViewName, sizeof( ViewName ), HiphopSongs[ item ][ SongName ] )
  352.         copy( ViewTime, sizeof( ViewTime ), HiphopSongs[ item ][ SongTime ] )
  353.         copy( ViewAuthor, sizeof( ViewAuthor ), HiphopSongs[ item ][ SongAuthor ] )
  354.         formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", HiphopFolder, HiphopSongs[ item ][ SongFile ] )
  355.     }
  356.    
  357.     if( Category[ id ] == 3 )
  358.     {
  359.         copy( ViewName, sizeof( ViewName ), TranceSongs[ item ][ SongName ] )
  360.         copy( ViewTime, sizeof( ViewTime ), TranceSongs[ item ][ SongTime ] )
  361.         copy( ViewAuthor, sizeof( ViewAuthor ), TranceSongs[ item ][ SongAuthor ] )
  362.         formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", TranceFolder, TranceSongs[ item ][ SongFile ] )
  363.     }
  364.    
  365.     if( Category[ id ] == 4 )
  366.     {
  367.         copy( ViewName, sizeof( ViewName ), DubstepSongs[ item ][ SongName ] )
  368.         copy( ViewTime, sizeof( ViewTime ), DubstepSongs[ item ][ SongTime ] )
  369.         copy( ViewAuthor, sizeof( ViewAuthor ), DubstepSongs[ item ][ SongAuthor ] )
  370.         formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", DubstepFolder, DubstepSongs[ item ][ SongFile ] )
  371.     }
  372.    
  373.     return show_info( id )
  374. }
  375.  
  376. /************** Song Info **************/
  377. public show_info( id )
  378. {
  379.     new szMenu[ 250 ]
  380.    
  381.     formatex( szMenu, charsmax( szMenu ), "\r# \wSong Info:^n^n\
  382.     \r- \wSong Name: \r%s^n\
  383.     \r- \wSong Time: \r%s^n\
  384.     \r- \wSong Author: \r%s", ViewName, ViewTime, ViewAuthor )
  385.    
  386.     new menu = menu_create( szMenu, "sub_info" )
  387.    
  388.     menu_additem( menu, "\wPlay Song" )
  389.    
  390.     menu_setprop( menu, MPROP_EXITNAME, "Back" )
  391.     menu_display( id, menu )
  392.    
  393.     return 1
  394. }
  395.  
  396. public sub_info( id, menu, item )
  397. {
  398.     if( item == MENU_EXIT )
  399.         return MusicMenu( id )
  400.    
  401.     ReplayChoose[ id ] = true
  402.     RandomStop[ id ] = true
  403.    
  404.     ColorChat( id, "Enjoy listening to ^3%s^1 song", ViewName )
  405.     client_cmd( id, "mp3 play ^"%s^"", ViewFile )
  406.     client_cmd( id, "MP3Volume %.1f", Mp3value[ id ] )
  407.    
  408.     for( new i = 1; i < get_maxplayers(); i++ )
  409.     {
  410.         if( BlockAdmin[ i ] )
  411.             continue
  412.        
  413.         if( PlayAll[ id ] )
  414.         {
  415.             RandomStop[ i ] = true
  416.             set_dhudmessage( 97, 97, 97, -1.0, 0.12, 0, 6.0, 8.0 )
  417.             show_dhudmessage( i, "Admin: %s has started ^"%s^" song^n enjoy", GetName( id ), ViewName )
  418.            
  419.             client_cmd( i, "mp3 play ^"%s^"", ViewFile )
  420.             client_cmd( i, "MP3Volume %.1f", Mp3value[ i ] )
  421.         }
  422.     }
  423.     return 0
  424. }
  425.  
  426. /************** Options **************/
  427. public Options( id )
  428. {
  429.     new szMenu[ 500 ], len, key
  430.    
  431.     len =  format( szMenu[ len ], charsmax( szMenu) - len,  "\r[\w %s \r]\w Options Menu^n^n", Prefix )
  432.     len += format( szMenu[ len ], charsmax( szMenu) - len, "\r1. \wBlock Admin Music: %s^n", BlockAdmin[ id ] ? "\rYes" : "\yNo" )
  433.     len += format( szMenu[ len ], charsmax( szMenu) - len, "\dThis options will block music^n" )
  434.     len += format( szMenu[ len ], charsmax( szMenu) - len, "\dwhen admin starts a song^n" )
  435.     len += format( szMenu[ len ], charsmax( szMenu) - len, "\y--------------------^n" )
  436.     len += format( szMenu[ len ], charsmax( szMenu) - len, "Admins Options^n^n" )
  437.    
  438.     if( !( get_user_flags( id ) & ADMIN_KICK ) )
  439.     {
  440.         key = MENU_KEY_1|MENU_KEY_0
  441.         len += format( szMenu[ len ], charsmax( szMenu) - len, "\d2. \wPlay For All Players: \rNo^n" )
  442.     }
  443.     else
  444.     {
  445.         key = MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_0
  446.         len += format( szMenu[ len ], charsmax( szMenu) - len, "\r2. \wPlay For All Players: %s^n", PlayAll[ id ] ? "\yYes" : "\rNo" )
  447.     }
  448.    
  449.     len += format( szMenu[ len ], charsmax( szMenu) - len, "\dSelect a song and it will^n")
  450.     len += format( szMenu[ len ], charsmax( szMenu) - len, "\dPlay for all players^n^n")
  451.    
  452.     if( !( get_user_flags( id ) & ADMIN_KICK ) )
  453.         len += format( szMenu[ len ], charsmax( szMenu) - len, "\d5. \wStop Music For All Players^n" )
  454.     else
  455.         len += format( szMenu[ len ], charsmax( szMenu) - len, "\r5. \wStop Music For All Players^n" )
  456.    
  457.     len += format( szMenu[ len ], charsmax( szMenu) - len, "\dStop music for all players^n" )
  458.     len += format( szMenu[ len ], charsmax( szMenu) - len, "\y--------------------^n^n" )
  459.    
  460.     len += format( szMenu[ len ], charsmax( szMenu) - len, "\r0. \wBack" )
  461.    
  462.     show_menu( id, key, szMenu, -1, "OptionsMenu" )
  463.     return 1
  464. }
  465.  
  466. public Option( id, item )
  467. {
  468.     if( item == 9 ) return MusicMenu( id )
  469.     if( item == 0 )
  470.     {
  471.         BlockAdmin[ id ] = !BlockAdmin[ id ]
  472.         ColorChat( id, "You have^3 %sblocked^1 music from admin.", BlockAdmin[ id ] ? "" : "un" )
  473.     }
  474.    
  475.     if( item == 1 )
  476.     {
  477.         PlayAll[ id ] = !PlayAll[ id ]
  478.         ColorChat( id, "You have ^3%sabled^1 play music for all.", PlayAll[ id ] ? "en" : "dis" )
  479.     }
  480.    
  481.     if( item == 4 )
  482.     {
  483.         for( new i = 1; i < get_maxplayers(); i++ )
  484.         {
  485.             RandomStop[ i ] = false
  486.         }
  487.        
  488.         client_cmd( 0, "mp3 stop" )
  489.        
  490.         set_dhudmessage( 97, 97, 97, -1.0, 0.12, 0, 6.0, 8.0 )
  491.         show_dhudmessage( 0, "Admin: %s has stopped^nThe music for all players", GetName( id ) )
  492.        
  493.         ColorChat( 0, "Admin: ^3%s^1 has stopped music for all players.", GetName( id ) )
  494.     }
  495.    
  496.     return Options( id )
  497. }
  498.  
  499. /************** Replay sound **************/
  500. public Replay( id )
  501. {
  502.     if( ReplayChoose[ id ] == false )
  503.         return ColorChat( id, "You need to choose ^3song^1 to replay" )
  504.        
  505.     RandomStop[ id ] = true
  506.    
  507.     client_cmd( id, "mp3 play ^"%s^"", ViewFile )
  508.     client_cmd( id, "MP3Volume %.1f", Mp3value[ id ] )
  509.     return ColorChat( id, "Replay the last song you listened: ^3%s", ViewName )
  510. }
  511.  
  512. /************** Stop sound **************/
  513. public Stopsound( id )
  514. {
  515.     RandomStop[ id ] = false
  516.    
  517.     client_cmd( id, "mp3 stop" )
  518.     return ColorChat( id, "You ^3stopped^1 sound" )
  519. }
  520.  
  521. /************** Load ini **************/
  522. public LoadEnglish()
  523. {
  524.     if( !file_exists( EnglishCfg ) )
  525.     {
  526.         write_file( EnglishCfg, "; Song name    Song Time   Song Author Song file^n" )
  527.         write_file( EnglishCfg, "; Song name - the name of the song" )
  528.         write_file( EnglishCfg, "; Song Time - the duration of the song" )
  529.         write_file( EnglishCfg, "; Song Author - the Author's name" )
  530.         write_file( EnglishCfg, "; Song file -  The file of the song just need to write the name of the file without .mp3^n" )
  531.         write_file( EnglishCfg, "; Example - ^"Im sexy and i know it^" ^"5,24^" ^"omer adam^" ^"music/english/Im_sexy_and_i_know_it^"" )
  532.         log_amx( "No English were found!" )
  533.     }
  534.    
  535.     else if( file_exists( EnglishCfg ) )
  536.     {
  537.         new text[ 500 ]
  538.         new file = fopen( EnglishCfg, "rt" )
  539.        
  540.         while( !feof( file ) )
  541.         {
  542.             fgets( file, text, charsmax( text ) )
  543.             trim( text )
  544.             if( text[ 0 ] == ';' || !text[ 0 ] )
  545.                 continue
  546.            
  547.             parse( text, EnglishSongs[ EnglishLoaded ][ SongName ], 120, EnglishSongs[ EnglishLoaded ][ SongTime ], 120, EnglishSongs[ EnglishLoaded ][ SongAuthor ], 120, EnglishSongs[ EnglishLoaded ][ SongFile ], 120 )
  548.             replace_all( EnglishSongs[ EnglishLoaded ][ SongName ], 120, "_", " " )
  549.            
  550.             EnglishLoaded++
  551.         }
  552.        
  553.         fclose( file )
  554.     }
  555. }
  556.  
  557. public LoadHiphop()
  558. {
  559.     if( !file_exists( HiphopCfg ) )
  560.     {
  561.         write_file( HiphopCfg, "; Song name     Song Time   Song Author Song file^n" )
  562.         write_file( HiphopCfg, "; Song name - the name of the song" )
  563.         write_file( HiphopCfg, "; Song Time - the duration of the song" )
  564.         write_file( HiphopCfg, "; Song Author - the Author's name" )
  565.         write_file( HiphopCfg, "; Song file -  The file of the song just need to write the name of the file without .mp3^n" )
  566.         write_file( HiphopCfg, "; Example - ^"Im sexy and i know it^" ^"5,24^" ^"omer adam^" ^"music/hiphop/Im_sexy_and_i_know_it^"" )
  567.         log_amx( "No Hiphop were found!" )
  568.     }
  569.    
  570.     else if( file_exists( HiphopCfg ) )
  571.     {
  572.         new text[ 500 ]
  573.         new file = fopen( HiphopCfg, "rt" )
  574.        
  575.         while( !feof( file ) )
  576.         {
  577.             fgets( file, text, charsmax( text ) )
  578.             trim( text )
  579.             if( text[ 0 ] == ';' || !text[ 0 ] )
  580.                 continue
  581.            
  582.             parse( text, HiphopSongs[ HiphopLoaded ][ SongName ], 120, HiphopSongs[ HiphopLoaded ][ SongTime ], 120, HiphopSongs[ HiphopLoaded ][ SongAuthor ], 120, HiphopSongs[ HiphopLoaded ][ SongFile ], 120 )
  583.             replace_all( HiphopSongs[ HiphopLoaded ][ SongName ], 120, "_", " " )
  584.            
  585.             HiphopLoaded++
  586.         }
  587.        
  588.         fclose( file )
  589.     }
  590. }
  591.  
  592. public LoadTrance()
  593. {
  594.     if( !file_exists( TranceCfg ) )
  595.     {
  596.         write_file( TranceCfg, "; Song name     Song Time   Song Author Song file^n" )
  597.         write_file( TranceCfg, "; Song name - the name of the song" )
  598.         write_file( TranceCfg, "; Song Time - the duration of the song" )
  599.         write_file( TranceCfg, "; Song Author - the Author's name" )
  600.         write_file( TranceCfg, "; Song file -  The file of the song just need to write the name of the file without .mp3^n" )
  601.         write_file( TranceCfg, "; Example - ^"Im sexy and i know it^" ^"5,24^" ^"omer adam^" ^"music/trance/Im_sexy_and_i_know_it^"" )
  602.         log_amx( "No Trance were found!" )
  603.     }
  604.    
  605.     else if( file_exists( TranceCfg ) )
  606.     {
  607.         new text[ 500 ]
  608.         new file = fopen( TranceCfg, "rt" )
  609.        
  610.         while( !feof( file ) )
  611.         {
  612.             fgets( file, text, charsmax( text ) )
  613.             trim( text )
  614.             if( text[ 0 ] == ';' || !text[ 0 ] )
  615.                 continue
  616.            
  617.             parse( text, TranceSongs[ TranceLoaded ][ SongName ], 120, TranceSongs[ TranceLoaded ][ SongTime ], 120, TranceSongs[ TranceLoaded ][ SongAuthor ], 120, TranceSongs[ TranceLoaded ][ SongFile ], 120 )
  618.             replace_all( TranceSongs[ TranceLoaded ][ SongName ], 120, "_", " " )
  619.            
  620.             TranceLoaded++
  621.         }
  622.        
  623.         fclose( file )
  624.     }
  625. }
  626.  
  627. public LoadDubstep()
  628. {
  629.     if( !file_exists( DubstepCfg ) )
  630.     {
  631.         write_file( DubstepCfg, "; Song name    Song Time   Song Author Song file^n" )
  632.         write_file( DubstepCfg, "; Song name - the name of the song" )
  633.         write_file( DubstepCfg, "; Song Time - the duration of the song" )
  634.         write_file( DubstepCfg, "; Song Author - the Author's name" )
  635.         write_file( DubstepCfg, "; Song file -  The file of the song just need to write the name of the file without .mp3^n" )
  636.         write_file( DubstepCfg, "; Example - ^"Im sexy and i know it^" ^"5,24^" ^"omer adam^" ^"music/dubstep/Im_sexy_and_i_know_it^"" )
  637.         log_amx( "No Dubstep were found!" )
  638.     }
  639.    
  640.     else if( file_exists( DubstepCfg ) )
  641.     {
  642.         new text[ 500 ]
  643.         new file = fopen( DubstepCfg, "rt" )
  644.        
  645.         while( !feof( file ) )
  646.         {
  647.             fgets( file, text, charsmax( text ) )
  648.             trim( text )
  649.             if( text[ 0 ] == ';' || !text[ 0 ] )
  650.                 continue
  651.            
  652.             parse( text, DubstepSongs[ DubstepLoaded ][ SongName ], 120, DubstepSongs[ DubstepLoaded ][ SongTime ], 120, DubstepSongs[ DubstepLoaded ][ SongAuthor ], 120, DubstepSongs[ DubstepLoaded ][ SongFile ], 120 )
  653.             replace_all( DubstepSongs[ DubstepLoaded ][ SongName ], 120, "_", " " )
  654.            
  655.             DubstepLoaded++
  656.         }
  657.        
  658.         fclose( file )
  659.     }
  660. }
  661.  
  662. /************** Stocks **************/
  663. stock GetName( id )
  664. {
  665.     static szName[ 32 ]
  666.     get_user_name( id, szName, charsmax( szName ) )
  667.     return szName
  668. }
  669.  
  670. stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...)
  671. {
  672.     new msg[191], players[32], count = 1;
  673.     static len
  674.     len = formatex(msg, charsmax(msg), "^4[^1%s^4]^1 ", Prefix )
  675.     vformat(msg[len], charsmax(msg) - len, string, 3)
  676.    
  677.     if(id)
  678.         players[0] = id;
  679.     else
  680.         get_players(players,count,"ch")
  681.    
  682.     for (new i = 0; i < count; i++)
  683.     {
  684.         if(is_user_connected(players[i]))
  685.         {
  686.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i])
  687.             write_byte(players[i])
  688.             write_string(msg)
  689.             message_end()
  690.         }
  691.     }
  692.     return 1
  693. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement