From 6a4c55de7da1e1facde60281487767a7ab0b9f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Gr=C3=BCnbacher?= Date: Wed, 21 May 2014 18:47:20 +0200 Subject: [PATCH] Newmenus: Fire MENU_TIMEOUT on menuselect client command --- amxmodx/meta_api.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index f5fd25f5..061b922c 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -961,12 +961,30 @@ void C_ClientCommand(edict_t *pEntity) if (pPlayer->keys & bit_key) { - if ((pPlayer->menu > 0 && !pPlayer->vgui) && (gpGlobals->time > pPlayer->menuexpire)) + if (gpGlobals->time > pPlayer->menuexpire) { - pPlayer->menu = 0; - pPlayer->keys = 0; + int menu = pPlayer->newmenu; + if (menu >= 0 && menu < (int)g_NewMenus.size() && g_NewMenus[menu]) + { + Menu *pMenu = g_NewMenus[menu]; - RETURN_META(MRES_SUPERCEDE); + pPlayer->newmenu = -1; + pPlayer->menu = 0; + + executeForwards(pMenu->func, + static_cast(pPlayer->index), + static_cast(menu), + static_cast(MENU_TIMEOUT)); + + RETURN_META(MRES_SUPERCEDE); + } + else if (pPlayer->menu > 0 && !pPlayer->vgui) + { + pPlayer->menu = 0; + pPlayer->keys = 0; + + RETURN_META(MRES_SUPERCEDE); + } } int menuid = pPlayer->menu;