From d0ab27092c6d9fa419a122c52b69610a4bfea416 Mon Sep 17 00:00:00 2001 From: Arkshine Date: Fri, 24 Oct 2014 20:10:10 +0200 Subject: [PATCH] Allow show_menu native to send empty text and add reset_menu stock (bug 6244) --- amxmodx/util.cpp | 3 ++- plugins/include/amxmisc.inc | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/amxmodx/util.cpp b/amxmodx/util.cpp index e2c54c5d..891ca91c 100755 --- a/amxmodx/util.cpp +++ b/amxmodx/util.cpp @@ -57,7 +57,7 @@ void UTIL_ShowMenu(edict_t* pEdict, int slots, int time, char *menu, int mlen) if (!gmsgShowMenu) return; // some games don't support ShowMenu (Firearms) - while (*n) + do { a = mlen; if (a > 175) a = 175; @@ -74,6 +74,7 @@ void UTIL_ShowMenu(edict_t* pEdict, int slots, int time, char *menu, int mlen) *n = c; menu = n; } + while (*n); } /* warning - don't pass here const string */ diff --git a/plugins/include/amxmisc.inc b/plugins/include/amxmisc.inc index a4314f2f..ad3b9ef2 100755 --- a/plugins/include/amxmisc.inc +++ b/plugins/include/amxmisc.inc @@ -578,3 +578,15 @@ stock has_all_flags(id, const flags[]) new FlagsNumber=read_flags(flags); return ((get_user_flags(id) & FlagsNumber)==FlagsNumber); } + +/** + * Resets a client's menu. + * + * @note This is just a wrapper around show_menu for the sake of readability. + * + * @param index Client to reset menu to, use 0 to reset to all clients + */ +stock reset_menu(index) +{ + show_menu(index, 0, "", 0); +}