After round restart, they need open that menu again, to refresh menu.
PHP Code:
#include <sdktools>
public OnPluginStart()
{
RegConsoleCmd("sm_menu", command_menu);
HookEvent("round_start", round_start);
}
new bool:g_option_disabled[MAXPLAYERS+1];
public Action:command_menu(client, args)
{
if(client == 0 || !IsClientInGame(client))
{
return Plugin_Handled;
}
new Handle:menu = CreateMenu(menu_handler);
SetMenuTitle(menu, "my menu");
g_option_disabled[client] ? AddMenuItem(menu, "", "option 1", ITEMDRAW_DISABLED):AddMenuItem(menu, "", "option 1");
DisplayMenu(menu, client, MENU_TIME_FOREVER);
return Plugin_Handled;
}
public menu_handler(Handle:menu, MenuAction:action, param1, param2)
{
switch(action)
{
case MenuAction_End:
{
CloseHandle(menu);
}
case MenuAction_Select:
{
if(param2 == 0) // First menu option
{
g_option_disabled[param1] = true;
command_menu(param1, 0);
}
}
}
}
public round_start(Handle:event, const String:name[], bool:dontBroadcast)
{
for(new i = 1; i <= MaxClients; i++)
{
g_option_disabled[i] = false;
}
}