Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /************** Includes **************/
- #include < amxmodx >
- #include < amxmisc >
- #include < dhudmessage >
- /************** Defines **************/
- #define Prefix "AMXX"
- // config text
- #define EnglishCfg "addons/amxmodx/configs/music/english.txt"
- #define HiphopCfg "addons/amxmodx/configs/music/hiphop.txt"
- #define TranceCfg "addons/amxmodx/configs/music/trance.txt"
- #define DubstepCfg "addons/amxmodx/configs/music/dubstep.txt"
- #define EnglishFolder "music/english/"
- #define HiphopFolder "music/hiphop/"
- #define TranceFolder "music/trance/"
- #define DubstepFolder "music/dubstep/"
- #define folder "addons/amxmodx/configs/music"
- /************** News **************/
- // Vol stuff
- new const Volume[] [] =
- {
- "[\r----------\w]",
- "[\y+\r---------\w]",
- "[\y++\r--------\w]",
- "[\y+++\r-------\w]",
- "[\y++++\r------\w]",
- "[\y+++++\r-----\w]",
- "[\y++++++\r----\w]",
- "[\y+++++++\r---\w]",
- "[\y++++++++\r--\w]",
- "[\y+++++++++\r-\w]",
- "[\y++++++++++\w]"
- }
- new VolumeCTRL[ 33 ]
- new Float: Mp3value[ 33 ]
- // ini items
- enum _:SongProperties
- {
- SongName[ 31 ],
- SongTime[ 31 ],
- SongAuthor[ 31 ],
- SongFile[ 120 ]
- }
- // English Stuff
- new EnglishSongs[ 120 ][ SongProperties ], EnglishLoaded = 0
- // Hiphop Stuff
- new HiphopSongs[ 120 ][ SongProperties ], HiphopLoaded = 0
- // Trance Stuff
- new TranceSongs[ 120 ][ SongProperties ], TranceLoaded = 0
- // Dubstep Stuff
- new DubstepSongs[ 120 ][ SongProperties ], DubstepLoaded = 0
- // view menu
- new ViewName[ 31 ], ViewTime[ 31 ], ViewAuthor[ 31 ], ViewFile[ 120 ]
- // play all
- new PlayAll[ 33 ]
- // Block admin
- new bool: BlockAdmin[ 33 ]
- // Replay
- new bool: ReplayChoose[ 33 ]
- // stuff
- new RandomStop[ 33 ], Category[ 33 ] = 0
- public plugin_init()
- {
- register_plugin( "Advanced Music Menu", "v1.0", "RanAway" )
- // clcmd
- register_clcmd( "say /music", "MusicMenu" )
- register_clcmd( "say /stop", "Stopsound" )
- register_clcmd( "say /replay", "Replay" )
- // sub_menu
- register_menucmd( register_menuid( "menu_music" ), 1023, "sub_music" )
- register_menucmd( register_menuid( "OptionsMenu" ), 1023, "Option")
- // open folder
- if( !dir_exists( folder ) )
- mkdir( folder )
- }
- /************** plugin_precache **************/
- public plugin_precache()
- {
- LoadEnglish()
- LoadHiphop()
- LoadTrance()
- LoadDubstep()
- new szItem[ 256 ]
- for (new i = 0; i < EnglishLoaded; i++)
- {
- formatex( szItem, charsmax( szItem ), "sound/%s%s", EnglishFolder, EnglishSongs[ i ][ SongFile ] )
- precache_generic( szItem )
- }
- for (new i = 0; i < HiphopLoaded; i++)
- {
- formatex( szItem, charsmax( szItem ), "sound/%s%s", HiphopFolder, HiphopSongs[ i ][ SongFile ] )
- precache_generic( szItem )
- }
- for (new i = 0; i < TranceLoaded; i++)
- {
- formatex( szItem, charsmax( szItem ), "sound/%s%s", TranceFolder, TranceSongs[ i ][ SongFile ] )
- precache_generic( szItem )
- }
- for (new i = 0; i < DubstepLoaded; i++)
- {
- formatex( szItem, charsmax( szItem ), "sound/%s%s", DubstepFolder, DubstepSongs[ i ][ SongFile ] )
- precache_generic( szItem )
- }
- }
- /************** connect **************/
- public client_putinserver( id )
- {
- PlayAll[ id ] = false
- RandomStop[ id ] = false
- BlockAdmin[ id ] = false
- ReplayChoose[ id ] = false
- Mp3value[ id ] = 0.60
- VolumeCTRL[ id ] = 6
- Category[ id ] = 0
- }
- /************** Music menu **************/
- public MusicMenu( id )
- {
- new szMenu[ 250 ], len, key = MENU_KEY_6|MENU_KEY_9|MENU_KEY_0
- len = format( szMenu[ len ], charsmax( szMenu ) - len, "\r[\w %s \r]\w Music menu^n^n", Prefix )
- if( EnglishLoaded == 0 )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\d1. \wEnglish^n" )
- else
- {
- key = MENU_KEY_1
- len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r1. \wEnglish^n" )
- }
- if( HiphopLoaded == 0 )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\d2. \wHiphop^n" )
- else
- {
- key = MENU_KEY_2
- len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r2. \wHiphop^n" )
- }
- if( TranceLoaded == 0 )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\d3. \wTrance^n" )
- else
- {
- key = MENU_KEY_3
- len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r3. \wTrance^n" )
- }
- if( DubstepLoaded == 0 )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\d4. \wDubstep^n^n" )
- else
- {
- key = MENU_KEY_4
- len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r4. \wDubstep^n^n" )
- }
- len += format( szMenu[ len ], charsmax( szMenu ) - len, "\y--------------------^n" )
- if( EnglishLoaded == 0 && HiphopLoaded == 0 && TranceLoaded == 0 && DubstepLoaded == 0 )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\d5. \wRandom Music^n" )
- else
- {
- key = MENU_KEY_5
- len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r5. %s^n", RandomStop[ id ] ? "\rStopMusic\w" : "\yRandom Music\w")
- }
- len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r6. \yVol. \w%s^n", Volume[ VolumeCTRL[ id ] ] )
- len += format( szMenu[ len ], charsmax( szMenu ) - len, "\y--------------------^n^n" )
- len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r9. \wOptions Menu^n^n" )
- len += format( szMenu[ len ], charsmax( szMenu ) - len, "\r0. \wExit" )
- show_menu( id, key, szMenu, -1, "menu_music" )
- return 1
- }
- public sub_music( id, item )
- {
- if( item == MENU_EXIT ) return 1
- if( item == 0 ) Category[ id ] = 1, CategoryMenu( id )
- if( item == 1 ) Category[ id ] = 2, CategoryMenu( id )
- if( item == 2 ) Category[ id ] = 3, CategoryMenu( id )
- if( item == 3 ) Category[ id ] = 4, CategoryMenu( id )
- if( item == 4 )
- {
- ReplayChoose[ id ] = true
- RandomStop[ id ] = !RandomStop[ id ]
- if( RandomStop[ id ] )
- {
- for( new i = 1; i < get_maxplayers(); i++ )
- {
- if( BlockAdmin[ i ] )
- continue
- if( PlayAll[ id ] )
- {
- set_dhudmessage( 97, 97, 97, -1.0, 0.12, 0, 6.0, 8.0 )
- show_dhudmessage( i, "Admin %s has started ^"%s^" song^n enjoy", GetName( id ), ViewName )
- ReplayChoose[ i ] = true
- RandomStop[ i ] = true
- client_cmd( i, "mp3 play ^"%s^"", ViewFile )
- client_cmd( i, "MP3Volume %.1f", Mp3value[ i ] )
- }
- }
- new randommusic = random_num( 1,4 )
- if( randommusic == 1 )
- {
- new english = random_num( 0, sizeof EnglishLoaded )
- copy( ViewName, sizeof( ViewName ), EnglishSongs[ english ][ SongName ] )
- formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", EnglishFolder, EnglishSongs[ english ][ SongFile ] )
- }
- if( randommusic == 2 )
- {
- new hiphop = random_num( 0, sizeof HiphopLoaded )
- copy( ViewName, sizeof( ViewName ), HiphopSongs[ hiphop ][ SongName ] )
- formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", HiphopFolder, HiphopSongs[ hiphop ][ SongFile ] )
- }
- if( randommusic == 3 )
- {
- new trance = random_num( 0, sizeof TranceLoaded )
- copy( ViewName, sizeof( ViewName ), TranceSongs[ trance ][ SongName ] )
- formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", TranceFolder, TranceSongs[ trance ][ SongFile ] )
- }
- if( randommusic == 4 )
- {
- new dubstep = random_num( 0, sizeof DubstepLoaded )
- copy( ViewName, sizeof( ViewName ), DubstepSongs[ dubstep ][ SongName ] )
- formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", DubstepFolder, DubstepSongs[ dubstep ][ SongFile ] )
- }
- ColorChat( id, "Enjoy listening to ^3%s^1 song", ViewName )
- client_cmd( id, "mp3 play ^"%s^"", ViewFile )
- client_cmd( id, "MP3Volume %.1f", Mp3value[ id ] )
- }
- else
- Stopsound( id )
- MusicMenu( id )
- }
- if( item == 5 )
- {
- if( Mp3value[ id ] > 1.00 )
- Mp3value[ id ] = 0.0
- else
- Mp3value[ id ] += 0.10
- if( VolumeCTRL[ id ] == sizeof Volume - 1 )
- VolumeCTRL[ id ] = 0
- else
- VolumeCTRL[ id ]++
- client_cmd( id, "MP3Volume %.1f", Mp3value[ id ] )
- MusicMenu( id )
- }
- if( item == 8 ) Options( id )
- return 1
- }
- /************** Category Menu **************/
- public CategoryMenu( id )
- {
- new szMenu[ 250 ], szSong[ 250 ]
- if( Category[ id ] == 1 ) formatex( szMenu, charsmax( szMenu ), "\r[\w %s \r]\w English Menu\R", Prefix )
- if( Category[ id ] == 2 ) formatex( szMenu, charsmax( szMenu ), "\r[\w %s \r]\w Hiphop Menu\R", Prefix )
- if( Category[ id ] == 3 ) formatex( szMenu, charsmax( szMenu ), "\r[\w %s \r]\w Trance Menu\R", Prefix )
- if( Category[ id ] == 4 ) formatex( szMenu, charsmax( szMenu ), "\r[\w %s \r]\w Dubstep Menu\R", Prefix )
- new menu = menu_create( szMenu, "sub_category" )
- if( Category[ id ] == 1 )
- for( new i = 0; i < EnglishLoaded; ++i )
- formatex( szSong, charsmax( szSong ), "%s", EnglishSongs[ i ][ SongName ] )
- if( Category[ id ] == 2 )
- for( new i = 0; i < HiphopLoaded; ++i )
- formatex( szSong, charsmax( szSong ), "%s", HiphopSongs[ i ][ SongName ] )
- if( Category[ id ] == 3 )
- for( new i = 0; i < TranceLoaded; ++i )
- formatex( szSong, charsmax( szSong ), "%s", TranceSongs[ i ][ SongName ] )
- if( Category[ id ] == 4 )
- for( new i = 0; i < DubstepLoaded; ++i )
- formatex( szSong, charsmax( szSong ), "%s", DubstepSongs[ i ][ SongName ] )
- menu_additem( menu, szSong )
- menu_setprop( menu, MPROP_BACKNAME, "Previous Page" )
- menu_setprop( menu, MPROP_NEXTNAME, "Next Page" )
- menu_setprop( menu, MPROP_EXITNAME, "Back" )
- menu_display( id, menu )
- return 1
- }
- public sub_category( id, menu, item )
- {
- if( item == MENU_EXIT )
- return MusicMenu( id )
- if( Category[ id ] == 1 )
- {
- copy( ViewName, sizeof( ViewName ), EnglishSongs[ item ][ SongName ] )
- copy( ViewTime, sizeof( ViewTime ), EnglishSongs[ item ][ SongTime ] )
- copy( ViewAuthor, sizeof( ViewAuthor ), EnglishSongs[ item ][ SongAuthor ] )
- formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", EnglishFolder, EnglishSongs[ item ][ SongFile ] )
- }
- if( Category[ id ] == 2 )
- {
- copy( ViewName, sizeof( ViewName ), HiphopSongs[ item ][ SongName ] )
- copy( ViewTime, sizeof( ViewTime ), HiphopSongs[ item ][ SongTime ] )
- copy( ViewAuthor, sizeof( ViewAuthor ), HiphopSongs[ item ][ SongAuthor ] )
- formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", HiphopFolder, HiphopSongs[ item ][ SongFile ] )
- }
- if( Category[ id ] == 3 )
- {
- copy( ViewName, sizeof( ViewName ), TranceSongs[ item ][ SongName ] )
- copy( ViewTime, sizeof( ViewTime ), TranceSongs[ item ][ SongTime ] )
- copy( ViewAuthor, sizeof( ViewAuthor ), TranceSongs[ item ][ SongAuthor ] )
- formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", TranceFolder, TranceSongs[ item ][ SongFile ] )
- }
- if( Category[ id ] == 4 )
- {
- copy( ViewName, sizeof( ViewName ), DubstepSongs[ item ][ SongName ] )
- copy( ViewTime, sizeof( ViewTime ), DubstepSongs[ item ][ SongTime ] )
- copy( ViewAuthor, sizeof( ViewAuthor ), DubstepSongs[ item ][ SongAuthor ] )
- formatex( ViewFile, charsmax( ViewFile ), "sound/%s%s", DubstepFolder, DubstepSongs[ item ][ SongFile ] )
- }
- return show_info( id )
- }
- /************** Song Info **************/
- public show_info( id )
- {
- new szMenu[ 250 ]
- formatex( szMenu, charsmax( szMenu ), "\r# \wSong Info:^n^n\
- \r- \wSong Name: \r%s^n\
- \r- \wSong Time: \r%s^n\
- \r- \wSong Author: \r%s", ViewName, ViewTime, ViewAuthor )
- new menu = menu_create( szMenu, "sub_info" )
- menu_additem( menu, "\wPlay Song" )
- menu_setprop( menu, MPROP_EXITNAME, "Back" )
- menu_display( id, menu )
- return 1
- }
- public sub_info( id, menu, item )
- {
- if( item == MENU_EXIT )
- return MusicMenu( id )
- ReplayChoose[ id ] = true
- RandomStop[ id ] = true
- ColorChat( id, "Enjoy listening to ^3%s^1 song", ViewName )
- client_cmd( id, "mp3 play ^"%s^"", ViewFile )
- client_cmd( id, "MP3Volume %.1f", Mp3value[ id ] )
- for( new i = 1; i < get_maxplayers(); i++ )
- {
- if( BlockAdmin[ i ] )
- continue
- if( PlayAll[ id ] )
- {
- RandomStop[ i ] = true
- set_dhudmessage( 97, 97, 97, -1.0, 0.12, 0, 6.0, 8.0 )
- show_dhudmessage( i, "Admin: %s has started ^"%s^" song^n enjoy", GetName( id ), ViewName )
- client_cmd( i, "mp3 play ^"%s^"", ViewFile )
- client_cmd( i, "MP3Volume %.1f", Mp3value[ i ] )
- }
- }
- return 0
- }
- /************** Options **************/
- public Options( id )
- {
- new szMenu[ 500 ], len, key
- len = format( szMenu[ len ], charsmax( szMenu) - len, "\r[\w %s \r]\w Options Menu^n^n", Prefix )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\r1. \wBlock Admin Music: %s^n", BlockAdmin[ id ] ? "\rYes" : "\yNo" )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\dThis options will block music^n" )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\dwhen admin starts a song^n" )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\y--------------------^n" )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "Admins Options^n^n" )
- if( !( get_user_flags( id ) & ADMIN_KICK ) )
- {
- key = MENU_KEY_1|MENU_KEY_0
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\d2. \wPlay For All Players: \rNo^n" )
- }
- else
- {
- key = MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_0
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\r2. \wPlay For All Players: %s^n", PlayAll[ id ] ? "\yYes" : "\rNo" )
- }
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\dSelect a song and it will^n")
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\dPlay for all players^n^n")
- if( !( get_user_flags( id ) & ADMIN_KICK ) )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\d5. \wStop Music For All Players^n" )
- else
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\r5. \wStop Music For All Players^n" )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\dStop music for all players^n" )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\y--------------------^n^n" )
- len += format( szMenu[ len ], charsmax( szMenu) - len, "\r0. \wBack" )
- show_menu( id, key, szMenu, -1, "OptionsMenu" )
- return 1
- }
- public Option( id, item )
- {
- if( item == 9 ) return MusicMenu( id )
- if( item == 0 )
- {
- BlockAdmin[ id ] = !BlockAdmin[ id ]
- ColorChat( id, "You have^3 %sblocked^1 music from admin.", BlockAdmin[ id ] ? "" : "un" )
- }
- if( item == 1 )
- {
- PlayAll[ id ] = !PlayAll[ id ]
- ColorChat( id, "You have ^3%sabled^1 play music for all.", PlayAll[ id ] ? "en" : "dis" )
- }
- if( item == 4 )
- {
- for( new i = 1; i < get_maxplayers(); i++ )
- {
- RandomStop[ i ] = false
- }
- client_cmd( 0, "mp3 stop" )
- set_dhudmessage( 97, 97, 97, -1.0, 0.12, 0, 6.0, 8.0 )
- show_dhudmessage( 0, "Admin: %s has stopped^nThe music for all players", GetName( id ) )
- ColorChat( 0, "Admin: ^3%s^1 has stopped music for all players.", GetName( id ) )
- }
- return Options( id )
- }
- /************** Replay sound **************/
- public Replay( id )
- {
- if( ReplayChoose[ id ] == false )
- return ColorChat( id, "You need to choose ^3song^1 to replay" )
- RandomStop[ id ] = true
- client_cmd( id, "mp3 play ^"%s^"", ViewFile )
- client_cmd( id, "MP3Volume %.1f", Mp3value[ id ] )
- return ColorChat( id, "Replay the last song you listened: ^3%s", ViewName )
- }
- /************** Stop sound **************/
- public Stopsound( id )
- {
- RandomStop[ id ] = false
- client_cmd( id, "mp3 stop" )
- return ColorChat( id, "You ^3stopped^1 sound" )
- }
- /************** Load ini **************/
- public LoadEnglish()
- {
- if( !file_exists( EnglishCfg ) )
- {
- write_file( EnglishCfg, "; Song name Song Time Song Author Song file^n" )
- write_file( EnglishCfg, "; Song name - the name of the song" )
- write_file( EnglishCfg, "; Song Time - the duration of the song" )
- write_file( EnglishCfg, "; Song Author - the Author's name" )
- write_file( EnglishCfg, "; Song file - The file of the song just need to write the name of the file without .mp3^n" )
- write_file( EnglishCfg, "; Example - ^"Im sexy and i know it^" ^"5,24^" ^"omer adam^" ^"music/english/Im_sexy_and_i_know_it^"" )
- log_amx( "No English were found!" )
- }
- else if( file_exists( EnglishCfg ) )
- {
- new text[ 500 ]
- new file = fopen( EnglishCfg, "rt" )
- while( !feof( file ) )
- {
- fgets( file, text, charsmax( text ) )
- trim( text )
- if( text[ 0 ] == ';' || !text[ 0 ] )
- continue
- parse( text, EnglishSongs[ EnglishLoaded ][ SongName ], 120, EnglishSongs[ EnglishLoaded ][ SongTime ], 120, EnglishSongs[ EnglishLoaded ][ SongAuthor ], 120, EnglishSongs[ EnglishLoaded ][ SongFile ], 120 )
- replace_all( EnglishSongs[ EnglishLoaded ][ SongName ], 120, "_", " " )
- EnglishLoaded++
- }
- fclose( file )
- }
- }
- public LoadHiphop()
- {
- if( !file_exists( HiphopCfg ) )
- {
- write_file( HiphopCfg, "; Song name Song Time Song Author Song file^n" )
- write_file( HiphopCfg, "; Song name - the name of the song" )
- write_file( HiphopCfg, "; Song Time - the duration of the song" )
- write_file( HiphopCfg, "; Song Author - the Author's name" )
- write_file( HiphopCfg, "; Song file - The file of the song just need to write the name of the file without .mp3^n" )
- write_file( HiphopCfg, "; Example - ^"Im sexy and i know it^" ^"5,24^" ^"omer adam^" ^"music/hiphop/Im_sexy_and_i_know_it^"" )
- log_amx( "No Hiphop were found!" )
- }
- else if( file_exists( HiphopCfg ) )
- {
- new text[ 500 ]
- new file = fopen( HiphopCfg, "rt" )
- while( !feof( file ) )
- {
- fgets( file, text, charsmax( text ) )
- trim( text )
- if( text[ 0 ] == ';' || !text[ 0 ] )
- continue
- parse( text, HiphopSongs[ HiphopLoaded ][ SongName ], 120, HiphopSongs[ HiphopLoaded ][ SongTime ], 120, HiphopSongs[ HiphopLoaded ][ SongAuthor ], 120, HiphopSongs[ HiphopLoaded ][ SongFile ], 120 )
- replace_all( HiphopSongs[ HiphopLoaded ][ SongName ], 120, "_", " " )
- HiphopLoaded++
- }
- fclose( file )
- }
- }
- public LoadTrance()
- {
- if( !file_exists( TranceCfg ) )
- {
- write_file( TranceCfg, "; Song name Song Time Song Author Song file^n" )
- write_file( TranceCfg, "; Song name - the name of the song" )
- write_file( TranceCfg, "; Song Time - the duration of the song" )
- write_file( TranceCfg, "; Song Author - the Author's name" )
- write_file( TranceCfg, "; Song file - The file of the song just need to write the name of the file without .mp3^n" )
- write_file( TranceCfg, "; Example - ^"Im sexy and i know it^" ^"5,24^" ^"omer adam^" ^"music/trance/Im_sexy_and_i_know_it^"" )
- log_amx( "No Trance were found!" )
- }
- else if( file_exists( TranceCfg ) )
- {
- new text[ 500 ]
- new file = fopen( TranceCfg, "rt" )
- while( !feof( file ) )
- {
- fgets( file, text, charsmax( text ) )
- trim( text )
- if( text[ 0 ] == ';' || !text[ 0 ] )
- continue
- parse( text, TranceSongs[ TranceLoaded ][ SongName ], 120, TranceSongs[ TranceLoaded ][ SongTime ], 120, TranceSongs[ TranceLoaded ][ SongAuthor ], 120, TranceSongs[ TranceLoaded ][ SongFile ], 120 )
- replace_all( TranceSongs[ TranceLoaded ][ SongName ], 120, "_", " " )
- TranceLoaded++
- }
- fclose( file )
- }
- }
- public LoadDubstep()
- {
- if( !file_exists( DubstepCfg ) )
- {
- write_file( DubstepCfg, "; Song name Song Time Song Author Song file^n" )
- write_file( DubstepCfg, "; Song name - the name of the song" )
- write_file( DubstepCfg, "; Song Time - the duration of the song" )
- write_file( DubstepCfg, "; Song Author - the Author's name" )
- write_file( DubstepCfg, "; Song file - The file of the song just need to write the name of the file without .mp3^n" )
- write_file( DubstepCfg, "; Example - ^"Im sexy and i know it^" ^"5,24^" ^"omer adam^" ^"music/dubstep/Im_sexy_and_i_know_it^"" )
- log_amx( "No Dubstep were found!" )
- }
- else if( file_exists( DubstepCfg ) )
- {
- new text[ 500 ]
- new file = fopen( DubstepCfg, "rt" )
- while( !feof( file ) )
- {
- fgets( file, text, charsmax( text ) )
- trim( text )
- if( text[ 0 ] == ';' || !text[ 0 ] )
- continue
- parse( text, DubstepSongs[ DubstepLoaded ][ SongName ], 120, DubstepSongs[ DubstepLoaded ][ SongTime ], 120, DubstepSongs[ DubstepLoaded ][ SongAuthor ], 120, DubstepSongs[ DubstepLoaded ][ SongFile ], 120 )
- replace_all( DubstepSongs[ DubstepLoaded ][ SongName ], 120, "_", " " )
- DubstepLoaded++
- }
- fclose( file )
- }
- }
- /************** Stocks **************/
- stock GetName( id )
- {
- static szName[ 32 ]
- get_user_name( id, szName, charsmax( szName ) )
- return szName
- }
- stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...)
- {
- new msg[191], players[32], count = 1;
- static len
- len = formatex(msg, charsmax(msg), "^4[^1%s^4]^1 ", Prefix )
- vformat(msg[len], charsmax(msg) - len, string, 3)
- if(id)
- players[0] = id;
- else
- get_players(players,count,"ch")
- for (new i = 0; i < count; i++)
- {
- if(is_user_connected(players[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i])
- write_byte(players[i])
- write_string(msg)
- message_end()
- }
- }
- return 1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement