The solution is to use the menu item's "info" to uniquely identify the items in the menu. With this method, shown below, when you choose option 5, only option 5 will be executed.
PHP Code:
// Menu function
menu_additem(g_Menu, "Option 1", "1")
menu_additem(g_Menu, "Option 2", "2")
menu_additem(g_Menu, "Option 3", "3")
menu_additem(g_Menu, "Option 5", "5")
//...
// Handler function
new iAccess, szInfo[32], szName[32], callback
menu_item_getinfo(menu, item, iAccess, szInfo, charsmax(szInfo), szName, charsmax(szName), callback)
new iOption = str_to_num(szInfo)
switch(iOption)
{
case 1:
{
// Option 1
}
case 2:
{
// Option 2
}
case 3:
{
// Option 3
}
case 4:
{
// Option 4
}
case 5:
{
// Option 5
}
}
__________________