#include <amxmodx>
#define AUTHOR "aSior - amxx.pl/user/60210-asior/"
#define ForArray(%1,%2) for(new %1 = 0; %1 < sizeof %2; %1++)
#define ForRange(%1,%2,%3) for(new %1 = %2; %1 <= %3; %1++)
new const mainMenuCommands[][] =
{
"/menu"
};
new const mainMenuItems[][] =
{
"Kontakt",
"Vote ban",
"Sklep sms",
"Vip",
"IP",
"Round sounds",
"Rankstats",
"Resetscore",
"Mute",
"Wyjdz z serwera"
};
new const mainMenuExecuteCommands[][] =
{
"say /kontakt",
"say /voteban",
"say /sklepsms",
"say /vip",
"say /ip",
"say /rs",
"say /rankstats",
"say /resetscore",
"say /mute",
"disconnect"
};
public plugin_init()
{
register_plugin("x", "v0.1", AUTHOR);
registerCommands(mainMenuCommands, sizeof mainMenuCommands, "mainMenu");
}
public mainMenu(index)
{
new menuIndex = menu_create("Menu:", "mainMenu_handler");
ForArray(i, mainMenuItems)
menu_additem(menuIndex, mainMenuItems[i]);
menu_display(index, menuIndex);
return PLUGIN_HANDLED;
}
public mainMenu_handler(index, menu, item)
{
menu_destroy(menu);
if(item == MENU_EXIT)
return PLUGIN_HANDLED;
client_cmd(index, mainMenuExecuteCommands[item]);
return PLUGIN_HANDLED;
}
stock registerCommands(const array[][], arraySize, function[])
{
#if AMXX_VERSION_NUM < 183
ForRange(i, 0, arraySize - 1)
ForRange(j, 0, 1)
register_clcmd(fmt("%s %s", !j ? "say" : "say_team", array[i]), function);
#else
new newCommand[33];
ForRange(i, 0, arraySize - 1)
ForRange(j, 0, 1)
formatex(newCommand, charsmax(newCommand), "%s %s", !j ? "say" : "say_team", array[i]),
register_clcmd(newCommand, function);
#endif
}