#include <amxmodx>
#include <amxmisc>
new g_iZeneKibe[33][11];
new g_iLegjobb[33];
new iIndex;
new g_iMaxPlayers;
enum _:eAdat {
Zene[128],
ZeneCim[128]
};
new const Zenek[][eAdat] = {
// Mappa/Zene.mp3 Zene neve
{ "music/1.mp3", "M.R.K Mix 1", },
{ "music/2.mp3", "M.R.K Mix 2", },
{ "music/3.mp3", "M.R.K Mix 3", },
{ "music/4.mp3", "M.R.K Mix 4", },
{ "music/5.mp3", "M.R.K Mix 5", },
{ "music/6.mp3", "M.R.K Mix 6", },
{ "music/7.mp3", "M.R.K Mix 7", },
{ "music/8.mp3", "M.R.K Mix 8", },
{ "music/9.mp3", "M.R.K Mix 9", },
{ "music/10.mp3","M.R.K Mix 10", }
};
public plugin_init()
{
register_plugin("Music system", "1.0", "Ricsike34");
register_clcmd("say /zene", "zenemenu");
register_event("DeathMsg", "halal", "a");
g_iMaxPlayers = get_maxplayers();
register_logevent("LegjobbEllenorzes", 2, "1=Round_End");
register_logevent("Reset", 2, "1=Round_Start");
}
public reset()
{
for(new i = 0; i < g_iMaxPlayers; i++)
g_iLegjobb[i] = 0;
}
public plugin_precache()
{
for(new i; i<sizeof(Zenek); i++)
precache_sound(Zenek[i][Zene])
}
public halal()
{
new iGyilkos = read_data(1);
new iAldozat = read_data(2);
if(iGyilkos == iAldozat || !iAldozat || !iGyilkos)
return PLUGIN_HANDLED;
g_iLegjobb[iGyilkos]++;
return PLUGIN_HANDLED;
}
public LegjobbEllenorzes(id)
{
for(new i = 0; i < g_iMaxPlayers; i++)
Legjobb(i);
}
public Legjobb(id)
{
new iMax;
for(new i = 0; i < g_iMaxPlayers; i++)
{
if(g_iLegjobb[i] > iMax)
{
iMax = g_iLegjobb[i];
iIndex = i;
}
}
Lejatszas(iIndex);
}
public Lejatszas(id)
{
new sMp3[96], iRnd = 0;
for(new i = 0; i < 11; i++)
{
iRnd = random_num(0, 11);
if(g_iZeneKibe[iIndex][i] == 1)
{
formatex(sMp3, charsmax(sMp3), "sound/%s", Zenek[iRnd][Zene]);
client_cmd(id, "mp3 play %s", sMp3);
break;
}
else
continue;
}
}
public zenekeszlet(id)
{
new sCim[512], iMenu, sSor[8];
format(sCim, charsmax(sCim), "ZENEMENU \r- \dZene készlet")
iMenu = menu_create(sCim, "keszlet_h")
for(new i;i < sizeof(Zenek); i++)
{
num_to_str(i, sSor, charsmax(sSor));
formatex(sCim, charsmax(sCim), "%s", Zenek[i][ZeneCim]);
menu_additem(iMenu, sCim, sSor);
}
menu_display(id, iMenu, 0)
return PLUGIN_HANDLED
}
public keszlet_h(id, iMenu, iItem)
{
if(iItem == MENU_EXIT){menu_destroy(iMenu);return;}
new sData[10], sName[64];
new iAccess, iCallback;
menu_item_getinfo(iMenu, iItem, iAccess, sData, charsmax(sData), sName, charsmax(sName), iCallback);
new iKey = str_to_num(sData);
if(g_iZeneKibe[id][iKey] == 1)
{
client_print_color(id, print_team_default, "Kikapcsoltad a(z) %s zenét.", Zenek[iKey][Zene]);
g_iZeneKibe[id][iKey] = 0;
}
else
{
client_print_color(id, print_team_default, "Bekapcsoltad a(z) %s zenét.", Zenek[iKey][Zene]);
g_iZeneKibe[id][iKey] = 1;
}
}
public client_putinserver(id)
{
if(is_user_bot(id))return;
for(new i = 0; i < 11; i++)
g_iZeneKibe[id][i] = 0;
g_iLegjobb[id] = 0;
}