Raised This Month: $ Target: $400
 0% 

[SOLVED][CS] New Menus: pressing Back/Next triggers radio commands


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MeRcyLeZZ
Veteran Member
Join Date: Dec 2007
Old 06-16-2011 , 22:48   [SOLVED][CS] New Menus: pressing Back/Next triggers radio commands
Reply With Quote #1

Using AMXX new menu system, if the menu has multiple pages and you select Back/Next options, report radio messages will be triggered automatically ("8. Negative" and "9. Enemy Down").

NOTE: it seems this only happens if you have used any of the "radio3" commands before calling the menu.

Is anything wrong with the code or is this a bug in AMXX's new menu system? (someone filed a bug report about this but it's yet UNCONFIRMED)

Code:
#include <amxmodx> public plugin_init() {     register_plugin("New Menus Bug", "0", "test")     register_clcmd("say menu", "show_newmenu") } public show_newmenu(id) {     new menuid = menu_create("New Menu", "new_menu_handle")     menu_additem(menuid, "1", "1")     menu_additem(menuid, "2", "2")     menu_additem(menuid, "3", "3")     menu_additem(menuid, "4", "4")     menu_additem(menuid, "5", "5")     menu_additem(menuid, "6", "6")     menu_additem(menuid, "7", "7")     menu_additem(menuid, "8", "8")     menu_additem(menuid, "9", "9")     menu_display(id, menuid) } public new_menu_handle(id, menuid, item) {     // Menu was closed     if (item == MENU_EXIT)     {         menu_destroy(menuid)         return PLUGIN_HANDLED;     }         // Retrieve and display item number     new number[2], dummy     if (menu_item_getinfo(menuid, item, dummy, number, charsmax(number), _, _, dummy))         client_print(id, print_chat, "You selected item number %s", number)         menu_destroy(menuid)     return PLUGIN_HANDLED }
__________________

Last edited by MeRcyLeZZ; 06-19-2011 at 01:39. Reason: solved
MeRcyLeZZ is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-17-2011 , 05:07   Re: [CS] New Menus: pressing Back/Next triggers radio commands
Reply With Quote #2

I had this problem before too, haven't found a solution yet
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-17-2011 , 10:54   Re: [CS] New Menus: pressing Back/Next triggers radio commands
Reply With Quote #3

After doing some testing, I noticed a couple things:
1. When you use a radio menu (for example), your "menu code" is kept at that radio menu's menu code until you use the "exit" option.
2. When you open a custom menu from AMXX on top of a default CS menu (like radio menu), it keeps the default CS menu's menu code.

To fix this, you can just set the menu code to 0 every time you use show_menu() or menu_display().
This fix can also be applied to the AMXX core whenever it gets ready to be fixed.

Thanks to Connor for the offset and function in a post of his.

Code:
#include <amxmodx> #include <fakemeta> // m_iMenuCode = 205, "player" linux offset = 5 #define cs_set_user_menu(%1,%2) set_pdata_int(%1, 205, %2, 5) // ... // reset menu code to 0 so we don't conflict with other CS menus cs_set_user_menu(id, 0) // show our own menu menu_display(id, menu)

EDIT:

Replied to the Bug Report. Hopefully this will be fixed in one of the next few developer builds.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 06-17-2011 at 10:57.
Exolent[jNr] is offline
MeRcyLeZZ
Veteran Member
Join Date: Dec 2007
Old 06-18-2011 , 16:58   Re: [CS] New Menus: pressing Back/Next triggers radio commands
Reply With Quote #4

Quote:
Originally Posted by Exolent[jNr] View Post
To fix this, you can just set the menu code to 0 every time you use show_menu() or menu_display().
Thanks! Working perfectly now. And the code also fixes another bug: AMXX menus closing automatically when walking out of buyzones (which has also been reported here: https://bugs.alliedmods.net/show_bug.cgi?id=3199)
__________________

Last edited by MeRcyLeZZ; 06-18-2011 at 17:01.
MeRcyLeZZ is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode