Raised This Month: $ Target: $400
 0% 

How to judge that the menu is closed?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jack111331
Junior Member
Join Date: Aug 2012
Old 07-11-2014 , 11:36   How to judge that the menu is closed?
Reply With Quote #1

Is there any way to judge the menu has been closed?
jack111331 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-11-2014 , 15:14   Re: How to judge that the menu is closed?
Reply With Quote #2

Do you want to detect the moment when menu was closed, or just to check if a specific menu is not still open?
klippy is offline
jack111331
Junior Member
Join Date: Aug 2012
Old 07-11-2014 , 21:14   Re: How to judge that the menu is closed?
Reply With Quote #3

Quote:
Originally Posted by KliPPy View Post
Do you want to detect the moment when menu was closed, or just to check if a specific menu is not still open?
Just to check if a specific menu is not still open
jack111331 is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 07-11-2014 , 16:55   Re: How to judge that the menu is closed?
Reply With Quote #4

You could set a function to execute when player selects the exit key.

Code:
if( item == MENU_EXIT ) {  menu_destroy( menu );  // put function to execute here.  return plugin_handled; }

Quick example. Mobile post might not be indented sorry.
__________________

Last edited by Blizzard_87; 07-11-2014 at 16:56.
Blizzard_87 is offline
jack111331
Junior Member
Join Date: Aug 2012
Old 07-11-2014 , 21:18   Re: How to judge that the menu is closed?
Reply With Quote #5

Quote:
Originally Posted by Blizzard_87 View Post
You could set a function to execute when player selects the exit key.

Code:
if( item == MENU_EXIT ) {  menu_destroy( menu );  // put function to execute here.  return plugin_handled; }

Quick example. Mobile post might not be indented sorry.
It‘s a way to detect it
But there are lots of way to close menu like :
create a new menu to cancel the menu you are using
jack111331 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-11-2014 , 21:20   Re: How to judge that the menu is closed?
Reply With Quote #6

https://github.com/alliedmodders/amx....inc#L211-L229
__________________
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
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 07-12-2014 , 04:19   Re: How to judge that the menu is closed?
Reply With Quote #7

Use boolean variables .. Put on a specific boolean variable for each menu you have .. and suppose the menu is opened and then some other menu is opened .. the variable associated with previous menu is never turned false while the variable declared for other menu is set to true .. now you know what actually happened.
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then
devilicioux is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-12-2014 , 12:21   Re: How to judge that the menu is closed?
Reply With Quote #8

You can try with what Yami gave you, but there is also an CBasePlayer offset which determines which menu is currently open. You can use that to check for your menu(if you are using old menu system).
klippy is offline
jack111331
Junior Member
Join Date: Aug 2012
Old 07-13-2014 , 00:29   Re: How to judge that the menu is closed?
Reply With Quote #9

Quote:
Originally Posted by KliPPy View Post
You can try with what Yami gave you, but there is also an CBasePlayer offset which determines which menu is currently open. You can use that to check for your menu(if you are using old menu system).
uh
could you demonstrate how to use it

i try it but there is no any result..
jack111331 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-13-2014 , 01:23   Re: How to judge that the menu is closed?
Reply With Quote #10

Quote:
Originally Posted by jack111331 View Post
uh
could you demonstrate how to use it

i try it but there is no any result..
Better to use the function Yami posted. That way you can handle both types of menus.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet 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:09.


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