Diff
checker
文本
文本
图像
文档
Excel
文件夹
Legal
Enterprise
桌面版
定价
登录
下载 Diffchecker 桌面版
比较文本
查找两个文本文件之间的差异
工具
历史
实时编辑器
折叠未更改行
关闭换行
视图
拆分
统一
比对精度
智能
单词
字符
语法高亮
选择语法
忽略
文本转换
转到第一个差异
编辑输入
Diffchecker Desktop
运行Diffchecker最安全的方式。获取Diffchecker桌面应用:您的差异永远不会离开您的电脑!
获取桌面版
Edited BY NICKICZ
创建于
3年前
差异永不过期
清除
导出
分享
解释
20 删除
行
总计
删除
字符
总计
删除
要继续使用此功能,请升级到
Diff
checker
Pro
查看价格
438 行
全部复制
29 添加
行
总计
添加
字符
总计
添加
要继续使用此功能,请升级到
Diff
checker
Pro
查看价格
438 行
全部复制
/* Plugin generated by AMXX-Studio */
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmodx>
#include <amxmisc>
#include <amxmisc>
#include <ColorChat>
#include <ColorChat>
#define PLUGIN "RoundSound"
#define PLUGIN "RoundSound"
#define VERSION "2.1"
#define VERSION "2.1"
复制
已复制
复制
已复制
#define AUTHOR "speedkill
"
#define AUTHOR "speedkill
edit: N1K1Cz
"
new Array:g_PathCT,
new Array:g_PathCT,
Array:g_PathTT,
Array:g_PathTT,
Array:g_SoundNameCT,
Array:g_SoundNameCT,
Array:g_SoundNameTT;
Array:g_SoundNameTT;
new bool:g_RoundSound[33],
new bool:g_RoundSound[33],
bool:g_ShowAds[33],
bool:g_ShowAds[33],
bool:g_FirstPlay,
bool:g_FirstPlay,
bool:g_MusicPlaying;
bool:g_MusicPlaying;
new g_LastSong[96],
new g_LastSong[96],
g_LastSoundPath[96],
g_LastSoundPath[96],
g_Prefix[64],
g_Prefix[64],
g_ShowInfo[33],
g_ShowInfo[33],
g_ArraySize[4],
g_ArraySize[4],
g_Pcvar[5],
g_Pcvar[5],
g_ValueTeam[2],
g_ValueTeam[2],
g_ShowType,
g_ShowType,
g_MaxPlayers,
g_MaxPlayers,
g_PlaylistType,
g_PlaylistType,
g_RandomMusic,
g_RandomMusic,
g_ShowPlaylist;
g_ShowPlaylist;
new const g_ShowNames[][]={
new const g_ShowNames[][]={
"Brak",
"Brak",
"Czat"
"Czat"
};
};
new const g_CvarName[][]={
new const g_CvarName[][]={
"Roundsound_ads_time",
"Roundsound_ads_time",
"Roundsound_prefix",
"Roundsound_prefix",
"Roundsound_random_music",
"Roundsound_random_music",
"Roundsound_show_type",
"Roundsound_show_type",
"Roundsound_show_playlist"
"Roundsound_show_playlist"
};
};
new const g_CvarValue[][]={
new const g_CvarValue[][]={
"120",
"120",
复制
已复制
复制
已复制
"
RoundSound
",
"
>>MUZYKA N1K1Cz<<
",
"0",
"0",
"1",
"1",
"1"
"1"
};
};
new const g_LangCmd[][]={
new const g_LangCmd[][]={
"say /rs",
"say /rs",
"say /roundsound",
"say /roundsound",
"say_team /rs",
"say_team /rs",
"say_team /roundsound"
"say_team /roundsound"
};
};
new const g_LastLangCmd[][]={
new const g_LastLangCmd[][]={
"say /last",
"say /last",
"say_team /last"
"say_team /last"
};
};
enum{
enum{
Chat_Msg = 1
Chat_Msg = 1
};
};
public plugin_init() {
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_plugin(PLUGIN, VERSION, AUTHOR);
for(new i = 0; i < sizeof g_LangCmd; i++){
for(new i = 0; i < sizeof g_LangCmd; i++){
register_clcmd(g_LangCmd[i], "ShowRsMenu");
register_clcmd(g_LangCmd[i], "ShowRsMenu");
}
}
for(new i = 0; i < sizeof g_LastLangCmd; i++){
for(new i = 0; i < sizeof g_LastLangCmd; i++){
register_clcmd(g_LastLangCmd[i], "ShowLastSong");
register_clcmd(g_LastLangCmd[i], "ShowLastSong");
}
}
register_event("SendAudio", "PlaySoundTT", "a", "2&%!MRAD_terwin");
register_event("SendAudio", "PlaySoundTT", "a", "2&%!MRAD_terwin");
register_event("SendAudio", "PlaySoundCT", "a", "2&%!MRAD_ctwin");
register_event("SendAudio", "PlaySoundCT", "a", "2&%!MRAD_ctwin");
register_logevent("RoundStart", 2, "1=Round_Start");
register_logevent("RoundStart", 2, "1=Round_Start");
for(new i = 0; i < sizeof g_CvarName; i++){
for(new i = 0; i < sizeof g_CvarName; i++){
g_Pcvar[i] = register_cvar(g_CvarName[i], g_CvarValue[i]);
g_Pcvar[i] = register_cvar(g_CvarName[i], g_CvarValue[i]);
}
}
}
}
public plugin_precache(){
public plugin_precache(){
g_PathCT = ArrayCreate(128);
g_PathCT = ArrayCreate(128);
g_PathTT = ArrayCreate(128);
g_PathTT = ArrayCreate(128);
g_SoundNameCT = ArrayCreate(96);
g_SoundNameCT = ArrayCreate(96);
g_SoundNameTT = ArrayCreate(96);
g_SoundNameTT = ArrayCreate(96);
LoadSounds();
LoadSounds();
}
}
public plugin_cfg(){
public plugin_cfg(){
get_pcvar_string(g_Pcvar[1], g_Prefix, charsmax(g_Prefix));
get_pcvar_string(g_Pcvar[1], g_Prefix, charsmax(g_Prefix));
g_ShowType = get_pcvar_num(g_Pcvar[3]);
g_ShowType = get_pcvar_num(g_Pcvar[3]);
g_RandomMusic = get_pcvar_num(g_Pcvar[2]);
g_RandomMusic = get_pcvar_num(g_Pcvar[2]);
g_ShowPlaylist = get_pcvar_num(g_Pcvar[4]);
g_ShowPlaylist = get_pcvar_num(g_Pcvar[4]);
if(get_pcvar_num(g_Pcvar[0]) >= 30){
if(get_pcvar_num(g_Pcvar[0]) >= 30){
set_task(get_pcvar_float(g_Pcvar[0]), "ShowAds",.flags = "b");
set_task(get_pcvar_float(g_Pcvar[0]), "ShowAds",.flags = "b");
}
}
g_MaxPlayers = get_maxplayers();
g_MaxPlayers = get_maxplayers();
g_ValueTeam[0] = g_ValueTeam[1] = -1;
g_ValueTeam[0] = g_ValueTeam[1] = -1;
}
}
public client_authorized(id){
public client_authorized(id){
g_RoundSound[id] = true;
g_RoundSound[id] = true;
g_ShowAds[id] = true;
g_ShowAds[id] = true;
g_ShowInfo[id] = g_ShowType;
g_ShowInfo[id] = g_ShowType;
}
}
public LoadSounds(){
public LoadSounds(){
new g_Path[128];
new g_Path[128];
formatex(g_Path[ get_configsdir(g_Path, charsmax(g_Path)) ], charsmax(g_Path), "/RoundSound.ini");
formatex(g_Path[ get_configsdir(g_Path, charsmax(g_Path)) ], charsmax(g_Path), "/RoundSound.ini");
if(file_exists(g_Path)){
if(file_exists(g_Path)){
new g_Line[256],
new g_Line[256],
g_SoundPath[128],
g_SoundPath[128],
g_Name[96],
g_Name[96],
g_Team[3],
g_Team[3],
g_Len;
g_Len;
for(new i = 0; read_file(g_Path, i, g_Line, charsmax(g_Line), g_Len); i++){
for(new i = 0; read_file(g_Path, i, g_Line, charsmax(g_Line), g_Len); i++){
if(!g_Len || !g_Line[0] || g_Line[0] == ';'){
if(!g_Len || !g_Line[0] || g_Line[0] == ';'){
continue;
continue;
}
}
parse(g_Line, g_SoundPath, charsmax(g_SoundPath), g_Name, charsmax(g_Name), g_Team, charsmax(g_Team));
parse(g_Line, g_SoundPath, charsmax(g_SoundPath), g_Name, charsmax(g_Name), g_Team, charsmax(g_Team));
new g_Value = strlen(g_SoundPath) - 4;
new g_Value = strlen(g_SoundPath) - 4;
log_amx("Path: %s | Title: %s | Team: %s | Format: %s", g_SoundPath, g_Name, g_Team, g_SoundPath[ g_Value ]);
log_amx("Path: %s | Title: %s | Team: %s | Format: %s", g_SoundPath, g_Name, g_Team, g_SoundPath[ g_Value ]);
if(equal(g_SoundPath[ g_Value ], ".mp3") || equal(g_SoundPath[ g_Value ], ".wav")){
if(equal(g_SoundPath[ g_Value ], ".mp3") || equal(g_SoundPath[ g_Value ], ".wav")){
if(equal(g_SoundPath[ g_Value ], ".mp3")){
if(equal(g_SoundPath[ g_Value ], ".mp3")){
format(g_SoundPath, charsmax(g_SoundPath), "sound/%s", g_SoundPath);
format(g_SoundPath, charsmax(g_SoundPath), "sound/%s", g_SoundPath);
precache_generic(g_SoundPath);
precache_generic(g_SoundPath);
}
}
else{
else{
precache_sound(g_SoundPath);
precache_sound(g_SoundPath);
}
}
if(equal(g_Team, "CT")){
if(equal(g_Team, "CT")){
ArrayPushString(g_PathCT, g_SoundPath);
ArrayPushString(g_PathCT, g_SoundPath);
ArrayPushString(g_SoundNameCT, g_Name);
ArrayPushString(g_SoundNameCT, g_Name);
}
}
else if(equal(g_Team, "TT")){
else if(equal(g_Team, "TT")){
ArrayPushString(g_PathTT, g_SoundPath);
ArrayPushString(g_PathTT, g_SoundPath);
ArrayPushString(g_SoundNameTT, g_Name);
ArrayPushString(g_SoundNameTT, g_Name);
}
}
复制
已复制
复制
已复制
log_amx("
File
%s
has a good
forma
t
", g_SoundPath);
log_amx("
Plik
%s
jest w dobrym
forma
cie
", g_SoundPath);
}
}
else{
else{
复制
已复制
复制
已复制
log_amx("
File
%s
has a bad
format", g_SoundPath);
log_amx("
Plik
%s
ma zly
format", g_SoundPath);
}
}
}
}
}
}
else{
else{
复制
已复制
复制
已复制
set_fail_state("
File
RoundSound.ini
doesn't exist in
config
s/
");
set_fail_state("
Plik
RoundSound.ini
nie zostal odnaleziony w
config
u
");
}
}
GetArraySize();
GetArraySize();
}
}
public GetArraySize(){
public GetArraySize(){
g_ArraySize[0] = ArraySize(g_PathCT);
g_ArraySize[0] = ArraySize(g_PathCT);
g_ArraySize[1] = ArraySize(g_PathTT);
g_ArraySize[1] = ArraySize(g_PathTT);
g_ArraySize[2] = ArraySize(g_SoundNameCT);
g_ArraySize[2] = ArraySize(g_SoundNameCT);
g_ArraySize[3] = ArraySize(g_SoundNameTT);
g_ArraySize[3] = ArraySize(g_SoundNameTT);
}
}
public ShowRsMenu(id){
public ShowRsMenu(id){
new g_FormatText[64];
new g_FormatText[64];
复制
已复制
复制
已复制
new g_Menu = menu_create("
\wRoundSound ustawienia
", "MenuChoose");
new g_Menu = menu_create("
\w[\r-|
\wRoundSound ustawienia
\r|-\w]
", "MenuChoose");
复制
已复制
复制
已复制
formatex(g_FormatText, charsmax(g_FormatText), "\
y
Roundsound: \r[\d%s\r]
", g_RoundSound[id] ? "ON" : "OFF");
formatex(g_FormatText, charsmax(g_FormatText), "\
w[\r-|\w
Roundsound: \r[\d%s\r]
|-\w]
", g_RoundSound[id] ? "ON" : "OFF");
menu_additem(g_Menu, g_FormatText);
menu_additem(g_Menu, g_FormatText);
复制
已复制
复制
已复制
menu_additem(g_Menu, "
\r
Odsluchaj utwory \yCT \d[\yPlaylista\d]
");
menu_additem(g_Menu, "
\w[\r-|\w
Odsluchaj utwory \yCT \d[\yPlaylista\d]
\r|-\w]
");
menu_additem(g_Menu, "\
y
Odsluchaj utwory \rTT \d[\rPlaylista\d]
");
menu_additem(g_Menu, "\
w[\r-|\w
Odsluchaj utwory \rTT \d[\rPlaylista\d]
\r|-\w]
");
复制
已复制
复制
已复制
formatex(g_FormatText, charsmax(g_FormatText), "
\r
Reklamy: \y[\d%s\y]
", g_ShowAds[id] ? "ON" : "OFF");
formatex(g_FormatText, charsmax(g_FormatText), "
\w[\r-|\w
Reklamy: \y[\d%s\y]
\r|-\w]
", g_ShowAds[id] ? "ON" : "OFF");
menu_additem(g_Menu, g_FormatText);
menu_additem(g_Menu, g_FormatText);
复制
已复制
复制
已复制
formatex(g_FormatText, charsmax(g_FormatText), "\
y
Wyswietlanie nazwy \rutworu: \y[\d%s\y]
", g_ShowNames[ g_ShowInfo[id] ]);
formatex(g_FormatText, charsmax(g_FormatText), "\
w[\r-|\w
Wyswietlanie nazwy \rutworu: \y[\d%s\y]
\r|-\w]
", g_ShowNames[ g_ShowInfo[id] ]);
menu_additem(g_Menu, g_FormatText);
menu_additem(g_Menu, g_FormatText);
复制
已复制
复制
已复制
menu_setprop(g_Menu, MPROP_EXITNAME, "
Wyjscie
");
menu_setprop(g_Menu, MPROP_EXITNAME, "
\r[\wX\r]
");
menu_display(id, g_Menu);
menu_display(id, g_Menu);
}
}
public MenuChoose(id, g_Menu, g_Item){
public MenuChoose(id, g_Menu, g_Item){
if(g_Item == MENU_EXIT){
if(g_Item == MENU_EXIT){
menu_destroy(g_Menu);
menu_destroy(g_Menu);
return PLUGIN_HANDLED;
return PLUGIN_HANDLED;
}
}
switch(g_Item){
switch(g_Item){
case 0:{
case 0:{
g_RoundSound[id] = !g_RoundSound[id];
g_RoundSound[id] = !g_RoundSound[id];
ColorChat(id, TEAM_COLOR, "[%s]^x04 Roundsound:^x03 %s", g_Prefix, g_RoundSound[id] ? "wlaczony" : "wylaczony");
ColorChat(id, TEAM_COLOR, "[%s]^x04 Roundsound:^x03 %s", g_Prefix, g_RoundSound[id] ? "wlaczony" : "wylaczony");
ShowRsMenu(id);
ShowRsMenu(id);
}
}
case 1..2:{
case 1..2:{
ShowPlaylist(id, g_Item);
ShowPlaylist(id, g_Item);
}
}
case 3:{
case 3:{
g_ShowAds[id] = !g_ShowAds[id];
g_ShowAds[id] = !g_ShowAds[id];
ColorChat(id, TEAM_COLOR, "[%s]^x04 Reklamy:^x03 %s", g_Prefix, g_ShowAds[id] ? "wlaczone" : "wylaczone");
ColorChat(id, TEAM_COLOR, "[%s]^x04 Reklamy:^x03 %s", g_Prefix, g_ShowAds[id] ? "wlaczone" : "wylaczone");
ShowRsMenu(id);
ShowRsMenu(id);
}
}
case 4:{
case 4:{
if(g_ShowInfo[id] >= 1){
if(g_ShowInfo[id] >= 1){
g_ShowInfo[id] = -1;
g_ShowInfo[id] = -1;
}
}
g_ShowInfo[id]++;
g_ShowInfo[id]++;
ShowRsMenu(id);
ShowRsMenu(id);
}
}
}
}
menu_destroy(g_Menu);
menu_destroy(g_Menu);
return PLUGIN_HANDLED;
return PLUGIN_HANDLED;
}
}
public ShowPlaylist(id, g_Type){
public ShowPlaylist(id, g_Type){
new g_FormatText[64],
new g_FormatText[64],
g_Name[96];
g_Name[96];
formatex(g_FormatText, charsmax(g_FormatText), "Playlista \d%s", g_Type == 1 ? "CT" : "TT");
formatex(g_FormatText, charsmax(g_FormatText), "Playlista \d%s", g_Type == 1 ? "CT" : "TT");
new g_Menu = menu_create(g_FormatText, "PlaylistChoose");
new g_Menu = menu_create(g_FormatText, "PlaylistChoose");
switch(g_Type){
switch(g_Type){
case 1:{
case 1:{
for(new g_Item = 0; g_Item < g_ArraySize[2]; g_Item++){
for(new g_Item = 0; g_Item < g_ArraySize[2]; g_Item++){
if(g_ShowPlaylist){
if(g_ShowPlaylist){
ArrayGetString(g_SoundNameCT, g_Item, g_Name, charsmax(g_Name));
ArrayGetString(g_SoundNameCT, g_Item, g_Name, charsmax(g_Name));
}
}
else{
else{
formatex(g_Name, charsmax(g_Name), "Utwor numer #%d", ( g_Item + 1 ));
formatex(g_Name, charsmax(g_Name), "Utwor numer #%d", ( g_Item + 1 ));
}
}
menu_additem(g_Menu, g_Name);
menu_additem(g_Menu, g_Name);
}
}
}
}
case 2:{
case 2:{
for(new g_Item = 0; g_Item < g_ArraySize[3]; g_Item++){
for(new g_Item = 0; g_Item < g_ArraySize[3]; g_Item++){
if(g_ShowPlaylist){
if(g_ShowPlaylist){
ArrayGetString(g_SoundNameTT, g_Item, g_Name, charsmax(g_Name));
ArrayGetString(g_SoundNameTT, g_Item, g_Name, charsmax(g_Name));
}
}
else{
else{
formatex(g_Name, charsmax(g_Name), "Utwor numer #%d", ( g_Item + 1));
formatex(g_Name, charsmax(g_Name), "Utwor numer #%d", ( g_Item + 1));
}
}
menu_additem(g_Menu, g_Name);
menu_additem(g_Menu, g_Name);
}
}
}
}
}
}
g_PlaylistType = g_Type;
g_PlaylistType = g_Type;
复制
已复制
复制
已复制
menu_setprop(g_Menu, MPROP_BACKNAME, "
Powrot
");
menu_setprop(g_Menu, MPROP_BACKNAME, "
\y<<<
");
menu_setprop(g_Menu, MPROP_NEXTNAME, "
Dalej
");
menu_setprop(g_Menu, MPROP_NEXTNAME, "
\y>>>
");
menu_setprop(g_Menu, MPROP_EXITNAME, "
Wyjscie
");
menu_setprop(g_Menu, MPROP_EXITNAME, "
\r[\wX\r]
");
menu_setprop(g_Menu, MPROP_NUMBER_COLOR, "\r");
menu_setprop(g_Menu, MPROP_NUMBER_COLOR, "\r");
menu_display(id, g_Menu);
menu_display(id, g_Menu);
}
}
public PlaylistChoose(id, g_Menu, g_Item){
public PlaylistChoose(id, g_Menu, g_Item){
if(g_Item == MENU_EXIT){
if(g_Item == MENU_EXIT){
menu_destroy(g_Menu);
menu_destroy(g_Menu);
return PLUGIN_HANDLED;
return PLUGIN_HANDLED;
}
}
new g_SoundPath[128];
new g_SoundPath[128];
ArrayGetString(g_PlaylistType == 1 ? g_PathCT : g_PathTT, g_Item, g_SoundPath, charsmax(g_SoundPath));
ArrayGetString(g_PlaylistType == 1 ? g_PathCT : g_PathTT, g_Item, g_SoundPath, charsmax(g_SoundPath));
new g_Format = strlen(g_SoundPath) - 4;
new g_Format = strlen(g_SoundPath) - 4;
if(equal(g_SoundPath[ g_Format ], ".mp3")){
if(equal(g_SoundPath[ g_Format ], ".mp3")){
client_cmd(id, "mp3 play %s", g_SoundPath);
client_cmd(id, "mp3 play %s", g_SoundPath);
}
}
else{
else{
client_cmd(id, "spk %s", g_SoundPath);
client_cmd(id, "spk %s", g_SoundPath);
}
}
ShowPlaylist(id, g_PlaylistType);
ShowPlaylist(id, g_PlaylistType);
return PLUGIN_CONTINUE;
return PLUGIN_CONTINUE;
}
}
public ShowLastSong(id){
public ShowLastSong(id){
if(g_FirstPlay){
if(g_FirstPlay){
ColorChat(id, TEAM_COLOR, "[%s]^x04 Ostatni utwor:^x03 %s", g_Prefix, g_LastSong);
ColorChat(id, TEAM_COLOR, "[%s]^x04 Ostatni utwor:^x03 %s", g_Prefix, g_LastSong);
}
}
else{
else{
ColorChat(id, TEAM_COLOR, "[%s]^x04 Nie zostala odegrana zadna^x03 piosenka.", g_Prefix);
ColorChat(id, TEAM_COLOR, "[%s]^x04 Nie zostala odegrana zadna^x03 piosenka.", g_Prefix);
}
}
}
}
public RoundStart(){
public RoundStart(){
g_MusicPlaying = false;
g_MusicPlaying = false;
}
}
public PlaySoundTT(){
public PlaySoundTT(){
CheckMusic(1);
CheckMusic(1);
}
}
public PlaySoundCT(){
public PlaySoundCT(){
CheckMusic(2);
CheckMusic(2);
}
}
public CheckMusic(g_Type){
public CheckMusic(g_Type){
if(!g_MusicPlaying){
if(!g_MusicPlaying){
RandMusic(g_Type);
RandMusic(g_Type);
}
}
}
}
public RandMusic(g_Type){
public RandMusic(g_Type){
new g_SoundPath[128],
new g_SoundPath[128],
g_SoundName[128],
g_SoundName[128],
g_Name[96],
g_Name[96],
g_Format,
g_Format,
g_FileFormat;
g_FileFormat;
switch(g_Type){
switch(g_Type){
case 1:{
case 1:{
if(g_RandomMusic){
if(g_RandomMusic){
g_ValueTeam[0] = random(g_ArraySize[1]);
g_ValueTeam[0] = random(g_ArraySize[1]);
}
}
else{
else{
g_ValueTeam[0]++;
g_ValueTeam[0]++;
if(g_ValueTeam[0] >= g_ArraySize[1]){
if(g_ValueTeam[0] >= g_ArraySize[1]){
g_ValueTeam[0] = 0;
g_ValueTeam[0] = 0;
}
}
}
}
ArrayGetString(g_PathTT, g_ValueTeam[0], g_SoundPath, charsmax(g_SoundPath));
ArrayGetString(g_PathTT, g_ValueTeam[0], g_SoundPath, charsmax(g_SoundPath));
ArrayGetString(g_SoundNameTT, g_ValueTeam[0], g_Name, charsmax(g_Name));
ArrayGetString(g_SoundNameTT, g_ValueTeam[0], g_Name, charsmax(g_Name));
}
}
case 2:{
case 2:{
if(g_RandomMusic){
if(g_RandomMusic){
g_ValueTeam[1] = random(g_ArraySize[0]);
g_ValueTeam[1] = random(g_ArraySize[0]);
}
}
else{
else{
g_ValueTeam[1]++;
g_ValueTeam[1]++;
if(g_ValueTeam[1] >= g_ArraySize[0]){
if(g_ValueTeam[1] >= g_ArraySize[0]){
g_ValueTeam[1] = 0;
g_ValueTeam[1] = 0;
}
}
}
}
ArrayGetString(g_PathCT, g_ValueTeam[1], g_SoundPath, charsmax(g_SoundPath));
ArrayGetString(g_PathCT, g_ValueTeam[1], g_SoundPath, charsmax(g_SoundPath));
ArrayGetString(g_SoundNameCT, g_ValueTeam[1], g_Name, charsmax(g_Name));
ArrayGetString(g_SoundNameCT, g_ValueTeam[1], g_Name, charsmax(g_Name));
}
}
}
}
if(!equal(g_LastSoundPath, g_SoundPath)){
if(!equal(g_LastSoundPath, g_SoundPath)){
copy(g_LastSong, charsmax(g_LastSong), g_Name);
copy(g_LastSong, charsmax(g_LastSong), g_Name);
copy(g_LastSoundPath, charsmax(g_LastSoundPath), g_SoundPath);
copy(g_LastSoundPath, charsmax(g_LastSoundPath), g_SoundPath);
g_Format = strlen(g_SoundPath) - 4;
g_Format = strlen(g_SoundPath) - 4;
if(equal(g_SoundPath[ g_Format ], ".mp3")){
if(equal(g_SoundPath[ g_Format ], ".mp3")){
g_FileFormat = 1;
g_FileFormat = 1;
}
}
else{
else{
g_FileFormat = 2;
g_FileFormat = 2;
}
}
formatex(g_SoundName, charsmax(g_SoundName), "Teraz gramy: %s", g_Name);
formatex(g_SoundName, charsmax(g_SoundName), "Teraz gramy: %s", g_Name);
for(new i = 1; i <= g_MaxPlayers; i++){
for(new i = 1; i <= g_MaxPlayers; i++){
if(is_user_connected(i) && g_RoundSound[i]){
if(is_user_connected(i) && g_RoundSound[i]){
switch(g_FileFormat){
switch(g_FileFormat){
case 1:{
case 1:{
client_cmd(i, "mp3 play %s", g_SoundPath);
client_cmd(i, "mp3 play %s", g_SoundPath);
}
}
case 2:{
case 2:{
client_cmd(i, "spk %s", g_SoundPath);
client_cmd(i, "spk %s", g_SoundPath);
}
}
}
}
switch(g_ShowInfo[i]){
switch(g_ShowInfo[i]){
case Chat_Msg:{
case Chat_Msg:{
if(g_ShowPlaylist){
if(g_ShowPlaylist){
ColorChat(i, TEAM_COLOR, "[%s]^x04 %s", g_Prefix, g_SoundName);
ColorChat(i, TEAM_COLOR, "[%s]^x04 %s", g_Prefix, g_SoundName);
}
}
}
}
}
}
}
}
}
}
g_MusicPlaying = true;
g_MusicPlaying = true;
g_FirstPlay = true;
g_FirstPlay = true;
}
}
else{
else{
RandMusic(g_Type);
RandMusic(g_Type);
}
}
return PLUGIN_CONTINUE;
return PLUGIN_CONTINUE;
}
}
public ShowAds(){
public ShowAds(){
for(new i = 1; i <= g_MaxPlayers; i++){
for(new i = 1; i <= g_MaxPlayers; i++){
if(is_user_connected(i) && g_ShowAds[i]){
if(is_user_connected(i) && g_ShowAds[i]){
switch(random(4)){
switch(random(4)){
case 0:{
case 0:{
复制
已复制
复制
已复制
ColorChat(i, TEAM_COLOR, "[%s]^x04 Chcesz
%s
roundsound? Napisz^x03 /roundsound ^x04lub^x03 /rs", g_Prefix, g_RoundSound[i] ? "wylaczyc" : "wlaczyc");
ColorChat(i, TEAM_COLOR, "[%s]^x04 Chcesz
^x03
%s
^x04
roundsound? Napisz^x03 /roundsound ^x04lub^x03 /rs", g_Prefix, g_RoundSound[i] ? "wylaczyc" : "wlaczyc");
}
}
case 1:{
case 1:{
if(g_ShowPlaylist){
if(g_ShowPlaylist){
复制
已复制
复制
已复制
ColorChat(i, TEAM_COLOR, "[%s]^x04 Podobala Ci sie ostatnia piosenka
, a nie pamietasz jej nazwy
? Napisz^x03 /last", g_Prefix);
ColorChat(i, TEAM_COLOR, "[%s]^x04 Podobala Ci sie ostatnia piosenka
? Napisz^x03 /last", g_Prefix);
}
}
}
}
case 2:{
case 2:{
复制
已复制
复制
已复制
ColorChat(i, TEAM_COLOR, "[%s]^x04 Chcesz posluchac
utworow CT / TT
? Napisz^x03 /roundsound ^x04lub^x03 /rs", g_Prefix);
ColorChat(i, TEAM_COLOR, "[%s]^x04 Chcesz posluchac
muzyki
? Napisz^x03 /roundsound ^x04lub^x03 /rs", g_Prefix);
}
}
case 3:{
case 3:{
ColorChat(i, TEAM_COLOR, "[%s]^x04 Chcesz wylaczyc reklamy? Napisz^x03 /roundsound ^x04lub^x03 /rs", g_Prefix);
ColorChat(i, TEAM_COLOR, "[%s]^x04 Chcesz wylaczyc reklamy? Napisz^x03 /roundsound ^x04lub^x03 /rs", g_Prefix);
}
}
}
}
}
}
}
}
}
}
public plugin_end(){
public plugin_end(){
ArrayDestroy(g_PathCT);
ArrayDestroy(g_PathCT);
ArrayDestroy(g_PathTT);
ArrayDestroy(g_PathTT);
ArrayDestroy(g_SoundNameCT);
ArrayDestroy(g_SoundNameCT);
ArrayDestroy(g_SoundNameTT);
ArrayDestroy(g_SoundNameTT);
}
}
已保存差异
原始文本
打开文件
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <ColorChat> #define PLUGIN "RoundSound" #define VERSION "2.1" #define AUTHOR "speedkill" new Array:g_PathCT, Array:g_PathTT, Array:g_SoundNameCT, Array:g_SoundNameTT; new bool:g_RoundSound[33], bool:g_ShowAds[33], bool:g_FirstPlay, bool:g_MusicPlaying; new g_LastSong[96], g_LastSoundPath[96], g_Prefix[64], g_ShowInfo[33], g_ArraySize[4], g_Pcvar[5], g_ValueTeam[2], g_ShowType, g_MaxPlayers, g_PlaylistType, g_RandomMusic, g_ShowPlaylist; new const g_ShowNames[][]={ "Brak", "Czat" }; new const g_CvarName[][]={ "Roundsound_ads_time", "Roundsound_prefix", "Roundsound_random_music", "Roundsound_show_type", "Roundsound_show_playlist" }; new const g_CvarValue[][]={ "120", "RoundSound", "0", "1", "1" }; new const g_LangCmd[][]={ "say /rs", "say /roundsound", "say_team /rs", "say_team /roundsound" }; new const g_LastLangCmd[][]={ "say /last", "say_team /last" }; enum{ Chat_Msg = 1 }; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); for(new i = 0; i < sizeof g_LangCmd; i++){ register_clcmd(g_LangCmd[i], "ShowRsMenu"); } for(new i = 0; i < sizeof g_LastLangCmd; i++){ register_clcmd(g_LastLangCmd[i], "ShowLastSong"); } register_event("SendAudio", "PlaySoundTT", "a", "2&%!MRAD_terwin"); register_event("SendAudio", "PlaySoundCT", "a", "2&%!MRAD_ctwin"); register_logevent("RoundStart", 2, "1=Round_Start"); for(new i = 0; i < sizeof g_CvarName; i++){ g_Pcvar[i] = register_cvar(g_CvarName[i], g_CvarValue[i]); } } public plugin_precache(){ g_PathCT = ArrayCreate(128); g_PathTT = ArrayCreate(128); g_SoundNameCT = ArrayCreate(96); g_SoundNameTT = ArrayCreate(96); LoadSounds(); } public plugin_cfg(){ get_pcvar_string(g_Pcvar[1], g_Prefix, charsmax(g_Prefix)); g_ShowType = get_pcvar_num(g_Pcvar[3]); g_RandomMusic = get_pcvar_num(g_Pcvar[2]); g_ShowPlaylist = get_pcvar_num(g_Pcvar[4]); if(get_pcvar_num(g_Pcvar[0]) >= 30){ set_task(get_pcvar_float(g_Pcvar[0]), "ShowAds",.flags = "b"); } g_MaxPlayers = get_maxplayers(); g_ValueTeam[0] = g_ValueTeam[1] = -1; } public client_authorized(id){ g_RoundSound[id] = true; g_ShowAds[id] = true; g_ShowInfo[id] = g_ShowType; } public LoadSounds(){ new g_Path[128]; formatex(g_Path[ get_configsdir(g_Path, charsmax(g_Path)) ], charsmax(g_Path), "/RoundSound.ini"); if(file_exists(g_Path)){ new g_Line[256], g_SoundPath[128], g_Name[96], g_Team[3], g_Len; for(new i = 0; read_file(g_Path, i, g_Line, charsmax(g_Line), g_Len); i++){ if(!g_Len || !g_Line[0] || g_Line[0] == ';'){ continue; } parse(g_Line, g_SoundPath, charsmax(g_SoundPath), g_Name, charsmax(g_Name), g_Team, charsmax(g_Team)); new g_Value = strlen(g_SoundPath) - 4; log_amx("Path: %s | Title: %s | Team: %s | Format: %s", g_SoundPath, g_Name, g_Team, g_SoundPath[ g_Value ]); if(equal(g_SoundPath[ g_Value ], ".mp3") || equal(g_SoundPath[ g_Value ], ".wav")){ if(equal(g_SoundPath[ g_Value ], ".mp3")){ format(g_SoundPath, charsmax(g_SoundPath), "sound/%s", g_SoundPath); precache_generic(g_SoundPath); } else{ precache_sound(g_SoundPath); } if(equal(g_Team, "CT")){ ArrayPushString(g_PathCT, g_SoundPath); ArrayPushString(g_SoundNameCT, g_Name); } else if(equal(g_Team, "TT")){ ArrayPushString(g_PathTT, g_SoundPath); ArrayPushString(g_SoundNameTT, g_Name); } log_amx("File %s has a good format", g_SoundPath); } else{ log_amx("File %s has a bad format", g_SoundPath); } } } else{ set_fail_state("File RoundSound.ini doesn't exist in configs/"); } GetArraySize(); } public GetArraySize(){ g_ArraySize[0] = ArraySize(g_PathCT); g_ArraySize[1] = ArraySize(g_PathTT); g_ArraySize[2] = ArraySize(g_SoundNameCT); g_ArraySize[3] = ArraySize(g_SoundNameTT); } public ShowRsMenu(id){ new g_FormatText[64]; new g_Menu = menu_create("\wRoundSound ustawienia", "MenuChoose"); formatex(g_FormatText, charsmax(g_FormatText), "\yRoundsound: \r[\d%s\r]", g_RoundSound[id] ? "ON" : "OFF"); menu_additem(g_Menu, g_FormatText); menu_additem(g_Menu, "\rOdsluchaj utwory \yCT \d[\yPlaylista\d]"); menu_additem(g_Menu, "\yOdsluchaj utwory \rTT \d[\rPlaylista\d]"); formatex(g_FormatText, charsmax(g_FormatText), "\rReklamy: \y[\d%s\y]", g_ShowAds[id] ? "ON" : "OFF"); menu_additem(g_Menu, g_FormatText); formatex(g_FormatText, charsmax(g_FormatText), "\yWyswietlanie nazwy \rutworu: \y[\d%s\y]", g_ShowNames[ g_ShowInfo[id] ]); menu_additem(g_Menu, g_FormatText); menu_setprop(g_Menu, MPROP_EXITNAME, "Wyjscie"); menu_display(id, g_Menu); } public MenuChoose(id, g_Menu, g_Item){ if(g_Item == MENU_EXIT){ menu_destroy(g_Menu); return PLUGIN_HANDLED; } switch(g_Item){ case 0:{ g_RoundSound[id] = !g_RoundSound[id]; ColorChat(id, TEAM_COLOR, "[%s]^x04 Roundsound:^x03 %s", g_Prefix, g_RoundSound[id] ? "wlaczony" : "wylaczony"); ShowRsMenu(id); } case 1..2:{ ShowPlaylist(id, g_Item); } case 3:{ g_ShowAds[id] = !g_ShowAds[id]; ColorChat(id, TEAM_COLOR, "[%s]^x04 Reklamy:^x03 %s", g_Prefix, g_ShowAds[id] ? "wlaczone" : "wylaczone"); ShowRsMenu(id); } case 4:{ if(g_ShowInfo[id] >= 1){ g_ShowInfo[id] = -1; } g_ShowInfo[id]++; ShowRsMenu(id); } } menu_destroy(g_Menu); return PLUGIN_HANDLED; } public ShowPlaylist(id, g_Type){ new g_FormatText[64], g_Name[96]; formatex(g_FormatText, charsmax(g_FormatText), "Playlista \d%s", g_Type == 1 ? "CT" : "TT"); new g_Menu = menu_create(g_FormatText, "PlaylistChoose"); switch(g_Type){ case 1:{ for(new g_Item = 0; g_Item < g_ArraySize[2]; g_Item++){ if(g_ShowPlaylist){ ArrayGetString(g_SoundNameCT, g_Item, g_Name, charsmax(g_Name)); } else{ formatex(g_Name, charsmax(g_Name), "Utwor numer #%d", ( g_Item + 1 )); } menu_additem(g_Menu, g_Name); } } case 2:{ for(new g_Item = 0; g_Item < g_ArraySize[3]; g_Item++){ if(g_ShowPlaylist){ ArrayGetString(g_SoundNameTT, g_Item, g_Name, charsmax(g_Name)); } else{ formatex(g_Name, charsmax(g_Name), "Utwor numer #%d", ( g_Item + 1)); } menu_additem(g_Menu, g_Name); } } } g_PlaylistType = g_Type; menu_setprop(g_Menu, MPROP_BACKNAME, "Powrot"); menu_setprop(g_Menu, MPROP_NEXTNAME, "Dalej"); menu_setprop(g_Menu, MPROP_EXITNAME, "Wyjscie"); menu_setprop(g_Menu, MPROP_NUMBER_COLOR, "\r"); menu_display(id, g_Menu); } public PlaylistChoose(id, g_Menu, g_Item){ if(g_Item == MENU_EXIT){ menu_destroy(g_Menu); return PLUGIN_HANDLED; } new g_SoundPath[128]; ArrayGetString(g_PlaylistType == 1 ? g_PathCT : g_PathTT, g_Item, g_SoundPath, charsmax(g_SoundPath)); new g_Format = strlen(g_SoundPath) - 4; if(equal(g_SoundPath[ g_Format ], ".mp3")){ client_cmd(id, "mp3 play %s", g_SoundPath); } else{ client_cmd(id, "spk %s", g_SoundPath); } ShowPlaylist(id, g_PlaylistType); return PLUGIN_CONTINUE; } public ShowLastSong(id){ if(g_FirstPlay){ ColorChat(id, TEAM_COLOR, "[%s]^x04 Ostatni utwor:^x03 %s", g_Prefix, g_LastSong); } else{ ColorChat(id, TEAM_COLOR, "[%s]^x04 Nie zostala odegrana zadna^x03 piosenka.", g_Prefix); } } public RoundStart(){ g_MusicPlaying = false; } public PlaySoundTT(){ CheckMusic(1); } public PlaySoundCT(){ CheckMusic(2); } public CheckMusic(g_Type){ if(!g_MusicPlaying){ RandMusic(g_Type); } } public RandMusic(g_Type){ new g_SoundPath[128], g_SoundName[128], g_Name[96], g_Format, g_FileFormat; switch(g_Type){ case 1:{ if(g_RandomMusic){ g_ValueTeam[0] = random(g_ArraySize[1]); } else{ g_ValueTeam[0]++; if(g_ValueTeam[0] >= g_ArraySize[1]){ g_ValueTeam[0] = 0; } } ArrayGetString(g_PathTT, g_ValueTeam[0], g_SoundPath, charsmax(g_SoundPath)); ArrayGetString(g_SoundNameTT, g_ValueTeam[0], g_Name, charsmax(g_Name)); } case 2:{ if(g_RandomMusic){ g_ValueTeam[1] = random(g_ArraySize[0]); } else{ g_ValueTeam[1]++; if(g_ValueTeam[1] >= g_ArraySize[0]){ g_ValueTeam[1] = 0; } } ArrayGetString(g_PathCT, g_ValueTeam[1], g_SoundPath, charsmax(g_SoundPath)); ArrayGetString(g_SoundNameCT, g_ValueTeam[1], g_Name, charsmax(g_Name)); } } if(!equal(g_LastSoundPath, g_SoundPath)){ copy(g_LastSong, charsmax(g_LastSong), g_Name); copy(g_LastSoundPath, charsmax(g_LastSoundPath), g_SoundPath); g_Format = strlen(g_SoundPath) - 4; if(equal(g_SoundPath[ g_Format ], ".mp3")){ g_FileFormat = 1; } else{ g_FileFormat = 2; } formatex(g_SoundName, charsmax(g_SoundName), "Teraz gramy: %s", g_Name); for(new i = 1; i <= g_MaxPlayers; i++){ if(is_user_connected(i) && g_RoundSound[i]){ switch(g_FileFormat){ case 1:{ client_cmd(i, "mp3 play %s", g_SoundPath); } case 2:{ client_cmd(i, "spk %s", g_SoundPath); } } switch(g_ShowInfo[i]){ case Chat_Msg:{ if(g_ShowPlaylist){ ColorChat(i, TEAM_COLOR, "[%s]^x04 %s", g_Prefix, g_SoundName); } } } } } g_MusicPlaying = true; g_FirstPlay = true; } else{ RandMusic(g_Type); } return PLUGIN_CONTINUE; } public ShowAds(){ for(new i = 1; i <= g_MaxPlayers; i++){ if(is_user_connected(i) && g_ShowAds[i]){ switch(random(4)){ case 0:{ ColorChat(i, TEAM_COLOR, "[%s]^x04 Chcesz %s roundsound? Napisz^x03 /roundsound ^x04lub^x03 /rs", g_Prefix, g_RoundSound[i] ? "wylaczyc" : "wlaczyc"); } case 1:{ if(g_ShowPlaylist){ ColorChat(i, TEAM_COLOR, "[%s]^x04 Podobala Ci sie ostatnia piosenka, a nie pamietasz jej nazwy? Napisz^x03 /last", g_Prefix); } } case 2:{ ColorChat(i, TEAM_COLOR, "[%s]^x04 Chcesz posluchac utworow CT / TT? Napisz^x03 /roundsound ^x04lub^x03 /rs", g_Prefix); } case 3:{ ColorChat(i, TEAM_COLOR, "[%s]^x04 Chcesz wylaczyc reklamy? Napisz^x03 /roundsound ^x04lub^x03 /rs", g_Prefix); } } } } } public plugin_end(){ ArrayDestroy(g_PathCT); ArrayDestroy(g_PathTT); ArrayDestroy(g_SoundNameCT); ArrayDestroy(g_SoundNameTT); }
更改后文本
打开文件
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <ColorChat> #define PLUGIN "RoundSound" #define VERSION "2.1" #define AUTHOR "speedkill edit: N1K1Cz" new Array:g_PathCT, Array:g_PathTT, Array:g_SoundNameCT, Array:g_SoundNameTT; new bool:g_RoundSound[33], bool:g_ShowAds[33], bool:g_FirstPlay, bool:g_MusicPlaying; new g_LastSong[96], g_LastSoundPath[96], g_Prefix[64], g_ShowInfo[33], g_ArraySize[4], g_Pcvar[5], g_ValueTeam[2], g_ShowType, g_MaxPlayers, g_PlaylistType, g_RandomMusic, g_ShowPlaylist; new const g_ShowNames[][]={ "Brak", "Czat" }; new const g_CvarName[][]={ "Roundsound_ads_time", "Roundsound_prefix", "Roundsound_random_music", "Roundsound_show_type", "Roundsound_show_playlist" }; new const g_CvarValue[][]={ "120", ">>MUZYKA N1K1Cz<<", "0", "1", "1" }; new const g_LangCmd[][]={ "say /rs", "say /roundsound", "say_team /rs", "say_team /roundsound" }; new const g_LastLangCmd[][]={ "say /last", "say_team /last" }; enum{ Chat_Msg = 1 }; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); for(new i = 0; i < sizeof g_LangCmd; i++){ register_clcmd(g_LangCmd[i], "ShowRsMenu"); } for(new i = 0; i < sizeof g_LastLangCmd; i++){ register_clcmd(g_LastLangCmd[i], "ShowLastSong"); } register_event("SendAudio", "PlaySoundTT", "a", "2&%!MRAD_terwin"); register_event("SendAudio", "PlaySoundCT", "a", "2&%!MRAD_ctwin"); register_logevent("RoundStart", 2, "1=Round_Start"); for(new i = 0; i < sizeof g_CvarName; i++){ g_Pcvar[i] = register_cvar(g_CvarName[i], g_CvarValue[i]); } } public plugin_precache(){ g_PathCT = ArrayCreate(128); g_PathTT = ArrayCreate(128); g_SoundNameCT = ArrayCreate(96); g_SoundNameTT = ArrayCreate(96); LoadSounds(); } public plugin_cfg(){ get_pcvar_string(g_Pcvar[1], g_Prefix, charsmax(g_Prefix)); g_ShowType = get_pcvar_num(g_Pcvar[3]); g_RandomMusic = get_pcvar_num(g_Pcvar[2]); g_ShowPlaylist = get_pcvar_num(g_Pcvar[4]); if(get_pcvar_num(g_Pcvar[0]) >= 30){ set_task(get_pcvar_float(g_Pcvar[0]), "ShowAds",.flags = "b"); } g_MaxPlayers = get_maxplayers(); g_ValueTeam[0] = g_ValueTeam[1] = -1; } public client_authorized(id){ g_RoundSound[id] = true; g_ShowAds[id] = true; g_ShowInfo[id] = g_ShowType; } public LoadSounds(){ new g_Path[128]; formatex(g_Path[ get_configsdir(g_Path, charsmax(g_Path)) ], charsmax(g_Path), "/RoundSound.ini"); if(file_exists(g_Path)){ new g_Line[256], g_SoundPath[128], g_Name[96], g_Team[3], g_Len; for(new i = 0; read_file(g_Path, i, g_Line, charsmax(g_Line), g_Len); i++){ if(!g_Len || !g_Line[0] || g_Line[0] == ';'){ continue; } parse(g_Line, g_SoundPath, charsmax(g_SoundPath), g_Name, charsmax(g_Name), g_Team, charsmax(g_Team)); new g_Value = strlen(g_SoundPath) - 4; log_amx("Path: %s | Title: %s | Team: %s | Format: %s", g_SoundPath, g_Name, g_Team, g_SoundPath[ g_Value ]); if(equal(g_SoundPath[ g_Value ], ".mp3") || equal(g_SoundPath[ g_Value ], ".wav")){ if(equal(g_SoundPath[ g_Value ], ".mp3")){ format(g_SoundPath, charsmax(g_SoundPath), "sound/%s", g_SoundPath); precache_generic(g_SoundPath); } else{ precache_sound(g_SoundPath); } if(equal(g_Team, "CT")){ ArrayPushString(g_PathCT, g_SoundPath); ArrayPushString(g_SoundNameCT, g_Name); } else if(equal(g_Team, "TT")){ ArrayPushString(g_PathTT, g_SoundPath); ArrayPushString(g_SoundNameTT, g_Name); } log_amx("Plik %s jest w dobrym formacie", g_SoundPath); } else{ log_amx("Plik %s ma zly format", g_SoundPath); } } } else{ set_fail_state("Plik RoundSound.ini nie zostal odnaleziony w configu"); } GetArraySize(); } public GetArraySize(){ g_ArraySize[0] = ArraySize(g_PathCT); g_ArraySize[1] = ArraySize(g_PathTT); g_ArraySize[2] = ArraySize(g_SoundNameCT); g_ArraySize[3] = ArraySize(g_SoundNameTT); } public ShowRsMenu(id){ new g_FormatText[64]; new g_Menu = menu_create("\w[\r-|\wRoundSound ustawienia\r|-\w]", "MenuChoose"); formatex(g_FormatText, charsmax(g_FormatText), "\w[\r-|\wRoundsound: \r[\d%s\r]|-\w]", g_RoundSound[id] ? "ON" : "OFF"); menu_additem(g_Menu, g_FormatText); menu_additem(g_Menu, "\w[\r-|\wOdsluchaj utwory \yCT \d[\yPlaylista\d]\r|-\w]"); menu_additem(g_Menu, "\w[\r-|\wOdsluchaj utwory \rTT \d[\rPlaylista\d]\r|-\w]"); formatex(g_FormatText, charsmax(g_FormatText), "\w[\r-|\wReklamy: \y[\d%s\y]\r|-\w]", g_ShowAds[id] ? "ON" : "OFF"); menu_additem(g_Menu, g_FormatText); formatex(g_FormatText, charsmax(g_FormatText), "\w[\r-|\wWyswietlanie nazwy \rutworu: \y[\d%s\y]\r|-\w]", g_ShowNames[ g_ShowInfo[id] ]); menu_additem(g_Menu, g_FormatText); menu_setprop(g_Menu, MPROP_EXITNAME, "\r[\wX\r]"); menu_display(id, g_Menu); } public MenuChoose(id, g_Menu, g_Item){ if(g_Item == MENU_EXIT){ menu_destroy(g_Menu); return PLUGIN_HANDLED; } switch(g_Item){ case 0:{ g_RoundSound[id] = !g_RoundSound[id]; ColorChat(id, TEAM_COLOR, "[%s]^x04 Roundsound:^x03 %s", g_Prefix, g_RoundSound[id] ? "wlaczony" : "wylaczony"); ShowRsMenu(id); } case 1..2:{ ShowPlaylist(id, g_Item); } case 3:{ g_ShowAds[id] = !g_ShowAds[id]; ColorChat(id, TEAM_COLOR, "[%s]^x04 Reklamy:^x03 %s", g_Prefix, g_ShowAds[id] ? "wlaczone" : "wylaczone"); ShowRsMenu(id); } case 4:{ if(g_ShowInfo[id] >= 1){ g_ShowInfo[id] = -1; } g_ShowInfo[id]++; ShowRsMenu(id); } } menu_destroy(g_Menu); return PLUGIN_HANDLED; } public ShowPlaylist(id, g_Type){ new g_FormatText[64], g_Name[96]; formatex(g_FormatText, charsmax(g_FormatText), "Playlista \d%s", g_Type == 1 ? "CT" : "TT"); new g_Menu = menu_create(g_FormatText, "PlaylistChoose"); switch(g_Type){ case 1:{ for(new g_Item = 0; g_Item < g_ArraySize[2]; g_Item++){ if(g_ShowPlaylist){ ArrayGetString(g_SoundNameCT, g_Item, g_Name, charsmax(g_Name)); } else{ formatex(g_Name, charsmax(g_Name), "Utwor numer #%d", ( g_Item + 1 )); } menu_additem(g_Menu, g_Name); } } case 2:{ for(new g_Item = 0; g_Item < g_ArraySize[3]; g_Item++){ if(g_ShowPlaylist){ ArrayGetString(g_SoundNameTT, g_Item, g_Name, charsmax(g_Name)); } else{ formatex(g_Name, charsmax(g_Name), "Utwor numer #%d", ( g_Item + 1)); } menu_additem(g_Menu, g_Name); } } } g_PlaylistType = g_Type; menu_setprop(g_Menu, MPROP_BACKNAME, "\y<<<"); menu_setprop(g_Menu, MPROP_NEXTNAME, "\y>>>"); menu_setprop(g_Menu, MPROP_EXITNAME, "\r[\wX\r]"); menu_setprop(g_Menu, MPROP_NUMBER_COLOR, "\r"); menu_display(id, g_Menu); } public PlaylistChoose(id, g_Menu, g_Item){ if(g_Item == MENU_EXIT){ menu_destroy(g_Menu); return PLUGIN_HANDLED; } new g_SoundPath[128]; ArrayGetString(g_PlaylistType == 1 ? g_PathCT : g_PathTT, g_Item, g_SoundPath, charsmax(g_SoundPath)); new g_Format = strlen(g_SoundPath) - 4; if(equal(g_SoundPath[ g_Format ], ".mp3")){ client_cmd(id, "mp3 play %s", g_SoundPath); } else{ client_cmd(id, "spk %s", g_SoundPath); } ShowPlaylist(id, g_PlaylistType); return PLUGIN_CONTINUE; } public ShowLastSong(id){ if(g_FirstPlay){ ColorChat(id, TEAM_COLOR, "[%s]^x04 Ostatni utwor:^x03 %s", g_Prefix, g_LastSong); } else{ ColorChat(id, TEAM_COLOR, "[%s]^x04 Nie zostala odegrana zadna^x03 piosenka.", g_Prefix); } } public RoundStart(){ g_MusicPlaying = false; } public PlaySoundTT(){ CheckMusic(1); } public PlaySoundCT(){ CheckMusic(2); } public CheckMusic(g_Type){ if(!g_MusicPlaying){ RandMusic(g_Type); } } public RandMusic(g_Type){ new g_SoundPath[128], g_SoundName[128], g_Name[96], g_Format, g_FileFormat; switch(g_Type){ case 1:{ if(g_RandomMusic){ g_ValueTeam[0] = random(g_ArraySize[1]); } else{ g_ValueTeam[0]++; if(g_ValueTeam[0] >= g_ArraySize[1]){ g_ValueTeam[0] = 0; } } ArrayGetString(g_PathTT, g_ValueTeam[0], g_SoundPath, charsmax(g_SoundPath)); ArrayGetString(g_SoundNameTT, g_ValueTeam[0], g_Name, charsmax(g_Name)); } case 2:{ if(g_RandomMusic){ g_ValueTeam[1] = random(g_ArraySize[0]); } else{ g_ValueTeam[1]++; if(g_ValueTeam[1] >= g_ArraySize[0]){ g_ValueTeam[1] = 0; } } ArrayGetString(g_PathCT, g_ValueTeam[1], g_SoundPath, charsmax(g_SoundPath)); ArrayGetString(g_SoundNameCT, g_ValueTeam[1], g_Name, charsmax(g_Name)); } } if(!equal(g_LastSoundPath, g_SoundPath)){ copy(g_LastSong, charsmax(g_LastSong), g_Name); copy(g_LastSoundPath, charsmax(g_LastSoundPath), g_SoundPath); g_Format = strlen(g_SoundPath) - 4; if(equal(g_SoundPath[ g_Format ], ".mp3")){ g_FileFormat = 1; } else{ g_FileFormat = 2; } formatex(g_SoundName, charsmax(g_SoundName), "Teraz gramy: %s", g_Name); for(new i = 1; i <= g_MaxPlayers; i++){ if(is_user_connected(i) && g_RoundSound[i]){ switch(g_FileFormat){ case 1:{ client_cmd(i, "mp3 play %s", g_SoundPath); } case 2:{ client_cmd(i, "spk %s", g_SoundPath); } } switch(g_ShowInfo[i]){ case Chat_Msg:{ if(g_ShowPlaylist){ ColorChat(i, TEAM_COLOR, "[%s]^x04 %s", g_Prefix, g_SoundName); } } } } } g_MusicPlaying = true; g_FirstPlay = true; } else{ RandMusic(g_Type); } return PLUGIN_CONTINUE; } public ShowAds(){ for(new i = 1; i <= g_MaxPlayers; i++){ if(is_user_connected(i) && g_ShowAds[i]){ switch(random(4)){ case 0:{ ColorChat(i, TEAM_COLOR, "[%s]^x04 Chcesz^x03 %s ^x04roundsound? Napisz^x03 /roundsound ^x04lub^x03 /rs", g_Prefix, g_RoundSound[i] ? "wylaczyc" : "wlaczyc"); } case 1:{ if(g_ShowPlaylist){ ColorChat(i, TEAM_COLOR, "[%s]^x04 Podobala Ci sie ostatnia piosenka? Napisz^x03 /last", g_Prefix); } } case 2:{ ColorChat(i, TEAM_COLOR, "[%s]^x04 Chcesz posluchac muzyki? Napisz^x03 /roundsound ^x04lub^x03 /rs", g_Prefix); } case 3:{ ColorChat(i, TEAM_COLOR, "[%s]^x04 Chcesz wylaczyc reklamy? Napisz^x03 /roundsound ^x04lub^x03 /rs", g_Prefix); } } } } } public plugin_end(){ ArrayDestroy(g_PathCT); ArrayDestroy(g_PathTT); ArrayDestroy(g_SoundNameCT); ArrayDestroy(g_SoundNameTT); }
查找差异