/* Plugin generated by AMXX-Studio */ #include #include #include #define PLUGIN "Easy End Round Sounds" #define VERSION "0.1" #define AUTHOR "DarkGL" #define TASK_SHOW 111 #define TASK_INFORMATION 222 new Array:ct_sounds; new Array:tt_sounds; new bool:all_ok = true; new TAG[64]; new pinf; new ile = 3; new menuplaylist; new playlist new roundsound; new bool:play[33]; new g_max_players; new plosowo; new tt_ktora; new ct_ktora; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) if(!all_ok){ return PLUGIN_CONTINUE; } register_event( "SendAudio", "T_win" , "a", "2&%!MRAD_terwin"); register_event( "SendAudio", "CT_win", "a", "2&%!MRAD_ctwin"); new ptag = register_cvar("roundsound_tag","[Cs-Najarani.xaa.pl]"); pinf = register_cvar("roundsound_information_play","1"); plosowo = register_cvar("roundsound_mode","0") new sinf = register_cvar("roundsound_information_show","10.0"); if(get_pcvar_float(sinf) > 0.0){ set_task(get_pcvar_float(sinf),"information_show",TASK_INFORMATION,_,_,"b") } g_max_players = get_maxplayers(); get_pcvar_string(ptag,TAG,charsmax(TAG)) return PLUGIN_CONTINUE; } public client_connect(id) { play[id] = true; } public roundsound_on(id){ //play[id] = ~(play[id]<<32); if(play[id]){ play[id] = false; ColorChat(id,GREEN,"[%s] Wylaczyles roundsounda",TAG) } else { ColorChat(id,GREEN,"[%s] Wlaczyles roundsounda",TAG) play[id] = true; } return PLUGIN_HANDLED; } public playlist_show(id){ menu_display(id,menuplaylist); return PLUGIN_HANDLED; } public information_show(id){ static send=0; switch(send){ case 0: { if(!get_pcvar_num(playlist)){ if(get_pcvar_num(roundsound)){ ColorChat(0,TEAM_COLOR,"[%s] W celu wlaczenia/wylaczenie roundsounda napisz na czacie /roundsound",TAG) } } else { ColorChat(0,TEAM_COLOR,"[%s] Jesli chcesz przejrzec playliste napisz na czacie /playlista",TAG) send++; } } case 1: { send--; if(!get_pcvar_num(roundsound)){ if(get_pcvar_num(playlist)){ ColorChat(0,TEAM_COLOR,"[%s] Jesli chcesz przejrzec playliste napisz na czacie /playlista",TAG) } } else { ColorChat(0,TEAM_COLOR,"[%s] W celu wlaczenia/wylaczenie roundsounda napisz na czacie /roundsound",TAG) } } } } public playlist_show_handle(id,menu,item){ if(item == MENU_EXIT){ return PLUGIN_CONTINUE; } new szConfDir[128]; get_configsdir(szConfDir,charsmax(szConfDir)); switch(item){ case 0: { format(szConfDir,charsmax(szConfDir),"%s/ctplaylist.txt",szConfDir); show_motd(id,szConfDir,"PlayLista CT") } case 1: { format(szConfDir,charsmax(szConfDir),"%s/ttplaylist.txt",szConfDir); show_motd(id,szConfDir,"PlayLista TT") } } playlist_show(id) return PLUGIN_CONTINUE; } public T_win(){ new szPath[256]; if(get_pcvar_num(plosowo)){ ArrayGetString(tt_sounds,random_num(0,ArraySize(tt_sounds)-1),szPath,charsmax(szPath)) } else { if(tt_ktora>=ArraySize(tt_sounds)){ tt_ktora = 0; } ArrayGetString(tt_sounds,tt_ktora++,szPath,charsmax(szPath)) } play_sound(szPath) } public CT_win(){ new szPath[256]; if(get_pcvar_num(plosowo)){ ArrayGetString(ct_sounds,random_num(0,ArraySize(ct_sounds)-1),szPath,charsmax(szPath)) } else { if(ct_ktora>=ArraySize(tt_sounds)){ ct_ktora = 0; } ArrayGetString(ct_sounds,ct_ktora++,szPath,charsmax(szPath)) } play_sound(szPath) } public test(id){ client_print(id,print_chat,"%d",all_ok) new szPath[256] for(new i = 0;iPlayLista CT",-1) while(next_file(dp, szFile, charsmax(szFile))){ if(strlen(szFile) < 5){ continue; } formatex(szFullPath,charsmax(szFullPath),"%s/%s",szPath,szFile) precache_sound(szFullPath) ArrayPushString(ct_sounds,szFullPath) if(get_pcvar_num(playlist)){ remove_filepath(szFullPath,szName,charsmax(szName)) strtolower(szName) replace_all(szName,strlen(szName),".mp3","") replace_all(szName,strlen(szName),".wav","") format(szName,charsmax(szName),"%s
",szName) write_file(szConfDir,szName,-1) } } write_file(szConfDir,"
",-1) close_dir(dp); } else { all_ok = false; log_amx("Brak folderu z muzyka dla ct") } if(ArraySize(ct_sounds) == 0){ all_ok = false; return PLUGIN_CONTINUE; } get_pcvar_string(tt,szPath,charsmax(szPath)) formatex(szFullDir,charsmax(szFullDir),"sound/%s",szPath) get_configsdir(szConfDir,charsmax(szConfDir)); format(szConfDir,charsmax(szConfDir),"%s/ttplaylist.txt",szConfDir); if(file_exists(szConfDir)){ delete_file(szConfDir); } dp = open_dir(szFullDir, szFile, charsmax(szFile)); if(dp){ write_file(szConfDir,"PlayLista TT",-1) while(next_file(dp, szFile, charsmax(szFile))){ if(strlen(szFile) < 5){ continue; } formatex(szFullPath,charsmax(szFullPath),"%s/%s",szPath,szFile) precache_sound(szFullPath) ArrayPushString(tt_sounds,szFullPath) if(get_pcvar_num(playlist)){ remove_filepath(szFullPath,szName,charsmax(szName)) strtolower(szName) replace_all(szName,strlen(szName),".mp3","") replace_all(szName,strlen(szName),".wav","") format(szName,charsmax(szName),"%s
",szName) write_file(szConfDir,szName,-1) } } write_file(szConfDir,"
",-1) close_dir(dp); } else { all_ok = false; log_amx("Brak folderu z muzyka dla tt") } if(ArraySize(tt_sounds) == 0){ all_ok = false; } return PLUGIN_CONTINUE; } play_sound(file[]){ for(new i = 1;i<=g_max_players;i++){ if(!is_user_connected(i) || !play[i]){ continue; } client_cmd(i,"%s%s",is_wav(file) ? "spk":"mp3 play sound/",file) } new szFile[256] remove_filepath(file,szFile,charsmax(szFile)) if(get_pcvar_num(pinf)){ ile = 3; strtolower(szFile) replace_all(szFile,strlen(szFile),".mp3","") replace_all(szFile,strlen(szFile),".wav","") set_task(1.0,"show_center",TASK_SHOW,szFile,sizeof(szFile)) } } public show_center(szFile[]){ for(new i = 1;i<=g_max_players;i++){ if(!is_user_connected(i) || !play[i]){ continue; } client_print(0,print_center,"[%s] Teraz Leci %s",TAG,szFile) } if(--ile > 0){ set_task(1.0,"show_center",TASK_SHOW,szFile,strlen(szFile)) } } bool:is_wav(file[]){ return (containi(file,".wav") > 0); } /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ ansicpg1250\\ deff0\\ deflang1045{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par } */