AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to judge that the menu is closed? (https://forums.alliedmods.net/showthread.php?t=243920)

jack111331 07-11-2014 11:36

How to judge that the menu is closed?
 
Is there any way to judge the menu has been closed?:3

klippy 07-11-2014 15:14

Re: How to judge that the menu is closed?
 
Do you want to detect the moment when menu was closed, or just to check if a specific menu is not still open?

Blizzard_87 07-11-2014 16:55

Re: How to judge that the menu is closed?
 
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.

jack111331 07-11-2014 21:14

Re: How to judge that the menu is closed?
 
Quote:

Originally Posted by KliPPy (Post 2165926)
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 07-11-2014 21:18

Re: How to judge that the menu is closed?
 
Quote:

Originally Posted by Blizzard_87 (Post 2165986)
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

YamiKaitou 07-11-2014 21:20

Re: How to judge that the menu is closed?
 
https://github.com/alliedmodders/amx....inc#L211-L229

devilicioux 07-12-2014 04:19

Re: How to judge that the menu is closed?
 
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.

klippy 07-12-2014 12:21

Re: How to judge that the menu is closed?
 
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).

jack111331 07-12-2014 22:54

Re: How to judge that the menu is closed?
 
ok
trying!!:3

jack111331 07-13-2014 00:29

Re: How to judge that the menu is closed?
 
Quote:

Originally Posted by KliPPy (Post 2166454)
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..


All times are GMT -4. The time now is 21:09.

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