Fix recursion issue with show_menu and newmenus

This commit is contained in:
Arkshine
2016-01-14 17:50:25 +01:00
parent af0042b71d
commit e634e512c8
3 changed files with 36 additions and 25 deletions

View File

@ -1251,8 +1251,11 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
pPlayer->menu = 0;
// Fire newmenu callback so closing it can be handled by the plugin
if (Menu *pMenu = get_menu_by_id(pPlayer->newmenu))
pMenu->Close(pPlayer->index);
if (!CloseNewMenus(pPlayer))
{
LogError(amx, AMX_ERR_NATIVE, "Plugin called menu_display when item=MENU_EXIT");
return 0;
}
UTIL_FakeClientCommand(pPlayer->pEdict, "menuselect", "10", 0);
}
@ -1274,8 +1277,11 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
pPlayer->menu = 0;
// Fire newmenu callback so closing it can be handled by the plugin
if (Menu *pMenu = get_menu_by_id(pPlayer->newmenu))
pMenu->Close(pPlayer->index);
if (!CloseNewMenus(pPlayer))
{
LogError(amx, AMX_ERR_NATIVE, "Plugin called menu_display when item=MENU_EXIT");
return 0;
}
UTIL_FakeClientCommand(pPlayer->pEdict, "menuselect", "10", 0);
}