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

Menu question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
diablix
Senior Member
Join Date: Jan 2010
Location: Warsaw, Poland
Old 12-09-2014 , 04:56   Menu question
Reply With Quote #1

I am kinda new to sourcemod and I was wondering whether it is possible to somehow use diffrent color for MenuItem? For example the same color which MenuTitle is using?
diablix is offline
Send a message via Skype™ to diablix
h3bus
AlliedModders Donor
Join Date: Nov 2013
Old 12-09-2014 , 06:04   Re: Menu question
Reply With Quote #2

I think you can with a panel, by displaying the item as disabled but still enabling the key.
It's a bit of work however.
h3bus is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 12-09-2014 , 16:41   Re: Menu question
Reply With Quote #3

There is only 2 color and one of them is reserved for key pressing (even if you can disable it but it will still use a number slot)

SetPanelKeys(menu, (1<<3)|(1<<4)|(1<<8)); Will enable key 4, 5 and 9.

Last edited by Mathias.; 12-09-2014 at 16:41.
Mathias. is offline
h3bus
AlliedModders Donor
Join Date: Nov 2013
Old 12-09-2014 , 17:00   Re: Menu question
Reply With Quote #4

Yes I think that's what he asked for, a disabled item (disabled color is title color), but still selectable by setting the keys.
h3bus is offline
sim242
AlliedModders Donor
Join Date: Dec 2012
Location: England
Old 12-10-2014 , 03:40   Re: Menu question
Reply With Quote #5

Quote:
Originally Posted by Black-Rabbit View Post
There is only 2 color and one of them is reserved for key pressing (even if you can disable it but it will still use a number slot)

SetPanelKeys(menu, (1<<3)|(1<<4)|(1<<); Will enable key 4, 5 and 9.
Could you explain how this enables keys 4, 5 and 9? I probably won't use this but I think it would be useful if I understand how it works
__________________
Steam - Sim
Request a private plugin
Not accepting requests at this time
sim242 is offline
Send a message via Skype™ to sim242
h3bus
AlliedModders Donor
Join Date: Nov 2013
Old 12-10-2014 , 07:15   Re: Menu question
Reply With Quote #6

This is a key bitmask. Basically, if bit N is equal to 1, key N+1 press will trigger panel callback (and remove panel from client display).

1<<3 | 1 << 4 | 1 << 8 meanse that following keys are enabled:
3+1 = 4
4+1 = 5
and 8+1 = 9
h3bus is offline
sim242
AlliedModders Donor
Join Date: Dec 2012
Location: England
Old 12-11-2014 , 04:57   Re: Menu question
Reply With Quote #7

Quote:
Originally Posted by h3bus View Post
This is a key bitmask. Basically, if bit N is equal to 1, key N+1 press will trigger panel callback (and remove panel from client display).

1<<3 | 1 << 4 | 1 << 8 meanse that following keys are enabled:
3+1 = 4
4+1 = 5
and 8+1 = 9
Ahhh thanks you very much, makes sense now. Could you not just write the number of the keys you want though?
__________________
Steam - Sim
Request a private plugin
Not accepting requests at this time
sim242 is offline
Send a message via Skype™ to sim242
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-11-2014 , 09:16   Re: Menu question
Reply With Quote #8

Quote:
Originally Posted by sim242 View Post
Ahhh thanks you very much, makes sense now. Could you not just write the number of the keys you want though?
If you wanted keys 4, 5, and 9 the number you'd have to enter is 280... which is 23 + 24 + 28.

1 << 3 | 1 << 4 | 1 << 8 is a much better way of putting it because you don't end up with a magic number in your code (the values for bits are documented in SetPanelKeys documentation and 1 << number is a well documented way of expressing bits.)
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
sim242
AlliedModders Donor
Join Date: Dec 2012
Location: England
Old 12-11-2014 , 14:02   Re: Menu question
Reply With Quote #9

Quote:
Originally Posted by Powerlord View Post
If you wanted keys 4, 5, and 9 the number you'd have to enter is 280... which is 23 + 24 + 28.

1 << 3 | 1 << 4 | 1 << 8 is a much better way of putting it because you don't end up with a magic number in your code (the values for bits are documented in SetPanelKeys documentation and 1 << number is a well documented way of expressing bits.)
Thanks for replying but what I meant was I wanted someone to explain why you can't literally just put SetPanelKeys(menu, 4, 5, 9); or something like that. Sorry if I didn't make it clear.
__________________
Steam - Sim
Request a private plugin
Not accepting requests at this time
sim242 is offline
Send a message via Skype™ to sim242
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 12-11-2014 , 18:11   Re: Menu question
Reply With Quote #10

Quote:
Originally Posted by sim242 View Post
Thanks for replying but what I meant was I wanted someone to explain why you can't literally just put SetPanelKeys(menu, 4, 5, 9); or something like that. Sorry if I didn't make it clear.
Because that not how it work... Powerlord could have not explain you it better, just read and pay attention to what he just told you.

Last edited by Mathias.; 12-11-2014 at 18:13.
Mathias. 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 12:21.


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