You can create the menu somewhere else, if g_infoTop is a global variable, tho you can create the variable and the whole menu in the first menu handler (you don't really need it to be global var)
Here's how I'd make it:
you can create a variable, szInfo[60] where to save both nick and steamid, and pass it on the menu_additem as the third parameter (as the szPosition I dont think you need it). on the new menu handler, get the menu info and parse it to get nick and steamid and show it on the menu.
PHP Code:
//create a variable szInfo[60] before the loop
if(iPosition == 1)
{
formatex(szData, charsmax(szData), "#%i - %s", iPosition, szName);
// here
formatex(szInfo, charsmax(szInfo), "%s %s", szName, szauthid)
menu_additem(g_Top, szData, szInfo);
if(id == 0) return;
} else {
formatex(szData, charsmax(szData), "#%i - %s", iPosition, szName);
formatex(szInfo, charsmax(szInfo), "%s %s", szName, szauthid)
menu_additem(g_Top, szData, szInfo);
}
handler
PHP Code:
public TopMenu_Handler(id, menuid, item)
{
if(!is_user_connected(id) || item == MENU_EXIT)
return PLUGIN_HANDLED;
new dummy, szInfo[60], argName[32], argAuthid[27]
menu_item_getinfo(menuid, item, dummy, szInfo, charsmax(szInfo), _, _, dummy)
parse(szInfo, argName, charsmax(argName), argAuthid, charsmax(argAuthid))
menu_additem(g_TopInfo, argName)
menu_additem(g_TopInfo, argAuthid)
menu_display(id, g_TopInfo);
return PLUGIN_HANDLED;
}
EDIT:
you can actually save menu's text (szName) directly from menu_item_getinfo:
PHP Code:
if(iPosition == 1)
{
formatex(szData, charsmax(szData), "#%i - %s", iPosition, szName);
// here
menu_additem(g_Top, szData, szauthid);
if(id == 0) return;
} else {
formatex(szData, charsmax(szData), "#%i - %s", iPosition, szName);
menu_additem(g_Top, szData, szauthid);
}
handler
PHP Code:
public TopMenu_Handler(id, menuid, item)
{
if(!is_user_connected(id) || item == MENU_EXIT)
return PLUGIN_HANDLED;
//SIZE = size of szauthid earlier
new dummy, argName[32], argAuthid[SIZE]
menu_item_getinfo(menuid, item, dummy, argAuthid, charsmax(argAuthid), argName, charsmax(argName), dummy)
menu_additem(g_TopInfo, argName)
menu_additem(g_TopInfo, argAuthid)
menu_display(id, g_TopInfo);
return PLUGIN_HANDLED;
}