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

how to check if menu is open ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 06-22-2019 , 04:38   how to check if menu is open ?
Reply With Quote #1

Hi,
I want to know what is best method to check if menu is still open for player example :
PHP Code:
public cancel_menu (id)
{
              if  ( 
// check here if the menu is not closed )                                          
              
{
                         
menu_destroy//what should I do here? )
                         
show_menu(//empty menu)
                   
return PLUGIN_HANDLED

I searched but didn't find anything good.
I know it's easy but I'm new to pawn.
LearninG is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-22-2019 , 07:12   Re: how to check if menu is open ?
Reply With Quote #2

PHP Code:
if(player_menu_infoid, ..... ) == 1)
{
     
//Player has menu!

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 06-22-2019 , 08:52   Re: how to check if menu is open ?
Reply With Quote #3

1more question , it is possible to use menu_destroy before show_menu (empty) if yes explain please:
Example:
PHP Code:
public cancel_menu (id)
{
                 
menu_destroymenu )
                 
show_menu(//empty menu)
          
return PLUGIN_HANDLED

I ask this because there is a set_task for public cancel_menu and I want after 20 seconds, menu gets destroyed and disappear from screen.
Thanks
LearninG is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-22-2019 , 09:08   Re: how to check if menu is open ?
Reply With Quote #4

https://forums.alliedmods.net/showth...46364#EndNotes
__________________








CrazY. is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-22-2019 , 11:57   Re: how to check if menu is open ?
Reply With Quote #5

If the menu / menu items are contansts then destroying the menu and creating it each time Isnt efficient instead just create it one time and destroy it when you got no use for it (one time use per map)

Also you need a valid newmenu id to destroy otherwise it will throw an error.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 06-22-2019 at 13:19.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 06-22-2019 , 12:49   Re: how to check if menu is open ?
Reply With Quote #6

thanks it solved.
LearninG 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 03:43.


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