Raised This Month: $51 Target: $400
 12% 

slot[1-10] with menu's (bug ?)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 09-06-2014 , 09:47   slot[1-10] with menu's (bug ?)
Reply With Quote #1

Hey;

I'm trying to find a way to get slot1-8 working, for choosing weapon, when a menu is showed.

So, my (permanent)-menu, gives information wich you can exit (0, slot10). But the problem when I have this menu, up and running, players cant use slot[1-9] anymore, tho the menu doesnt need them.

So is there a way to detect pressing 'exit / slot10', then I just use a hud, and remove it when pressed, or is it possible to make slot[1-9] working even menu is up ?

Thx
__________________
Retired.
Xalus is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 09-06-2014 , 19:23   Re: slot[1-10] with menu's (bug ?)
Reply With Quote #2

How are you displaying the menu?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 09-07-2014 , 04:34   Re: slot[1-10] with menu's (bug ?)
Reply With Quote #3

I try'd the old way 'show_menu( plr, 1<<9, menu, -1 );, and the new way, but both got same..
__________________
Retired.
Xalus is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 09-07-2014 , 05:51   Re: slot[1-10] with menu's (bug ?)
Reply With Quote #4

Quote:
Originally Posted by Xalus View Post
I try'd the old way 'show_menu( plr, 1<<9, menu, -1 );, and the new way, but both got same..
Show us your code. The menu system is working perfectly.

Last edited by Unkolix; 09-07-2014 at 05:51.
Unkolix is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 09-07-2014 , 07:59   Re: slot[1-10] with menu's (bug ?)
Reply With Quote #5

Quote:
Originally Posted by Unkolix View Post
Show us your code. The menu system is working perfectly.
You dont understand it..

Menu works yes, but menu blocks all 'slot-keys', even if your menu doesnt use these keys.

Cus slot1-4 (if I'm right), is for choosing weapons, but if you make a menu, with only option to close, slot1-8 is 'blocked' by menu.
__________________
Retired.
Xalus is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 09-07-2014 , 08:41   Re: slot[1-10] with menu's (bug ?)
Reply With Quote #6

I have 2 thoughts how to you might solve this:
in menu hook which slot was pressed,
1) exec that slot/weapon_name command on player
2) do some magic with ham by (maybe) deploying weapon on player
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 09-07-2014 , 12:41   Re: slot[1-10] with menu's (bug ?)
Reply With Quote #7

I could show menu back, when pressing slot1-5,

but how to show slot1 selecting effect then
__________________
Retired.
Xalus is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-07-2014 , 12:50   Re: slot[1-10] with menu's (bug ?)
Reply With Quote #8

Quote:
Originally Posted by Xalus View Post
I try'd the old way 'show_menu( plr, 1<<9, menu, -1 );, and the new way, but both got same..
That code says that only a single key is available to be used by the menu. So, at last, show more of your code or we can't really help you.
__________________
fysiks is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 09-07-2014 , 14:10   Re: slot[1-10] with menu's (bug ?)
Reply With Quote #9

Not sure what u wanna see in the full code but

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "Xalus"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_menucmdregister_menuid"\d          [Info]^n" ), 1023"Handler_Popup" );
    
    
register_clcmd("say a""Menu_Popup")
}
public 
Menu_Popupplr )
{
    static 
menu[2048];

    
formatmenusizeof menu 1"\d          [Info]^n\w0.\d ...." );
    
show_menuplr1<<9menu, -);
    
    return 
PLUGIN_HANDLED;
}
public 
Handler_Popupplrkey )
{
    
client_print(0print_chat"Press key (old): %i"key)
    
    if(
key == 9)
    {
        
// Exit menu
    
}

__________________
Retired.
Xalus is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-07-2014 , 16:28   Re: slot[1-10] with menu's (bug ?)
Reply With Quote #10

The "keys" supplied to the register_menucmd() command are the keys that will be able to call the menu handler. The "keys" supplied to show_menu() are the keys that will be selectable in-game. So, if you want a key to be both selectable and to call the menu handler, you need to have that key in both of two aforementioned functions.

It is not possible for the default weapon selection keys to work when you have a menu shown regardless of how many keys are part of the menu. That's normal behavior. You might be able to register the default weapons selection keys and fake it (handle in your handler somehow such that the menu briefly goes a way and you make them select that slot, maybe with client_cmd, then reshow the menu). This is actually implemented in one of the larger plugins here on the forum. I can't remember which though; I think it might be a map chooser plugin.


Other tips:

To make things easier for yourself and others, you should be using the definitions provided for keys to make your code readable:

amxconst.inc
PHP Code:
/* Menu keys */
#define MENU_KEY_1        (1<<0)
#define MENU_KEY_2        (1<<1)
#define MENU_KEY_3        (1<<2)
#define MENU_KEY_4        (1<<3)
#define MENU_KEY_5        (1<<4)
#define MENU_KEY_6        (1<<5)
#define MENU_KEY_7        (1<<6)
#define MENU_KEY_8        (1<<7)
#define MENU_KEY_9        (1<<8)
#define MENU_KEY_0        (1<<9) 
You can combine them like this:

PHP Code:
new MY_KEYS MENU_KEY_1 MENU_KEY_2 MENU_KEY_0 
Now, you can use MY_KEYS where ever you need to use the keys (e.g. in register_menucmd and show_menu).
__________________

Last edited by fysiks; 09-07-2014 at 16:46.
fysiks 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 21:06.


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