Raised This Month: $ Target: $400
 0% 

[RUNTIME ERROR] Invalid menu id 40(42)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 11-11-2011 , 09:08   [RUNTIME ERROR] Invalid menu id 40(42)
Reply With Quote #1

Hey guys, today my server crashed and when i checked in the log I saw in the error logs this log:

Code:
L 11/11/2011 - 15:56:05: Invalid menu id 45(46)
L 11/11/2011 - 15:56:05: [AMXX] Displaying debug trace (plugin "adminslots.amxx")
L 11/11/2011 - 15:56:05: [AMXX] Run time error 10: native error (native "menu_destroy")
L 11/11/2011 - 15:56:05: [AMXX]    [0] pimpdr.sma::shop_menu (line 2100)
And this is the code:

PHP Code:
public shop_menu(idmenuitem

    if( 
item == MENU_EXIT 
    { 
        
menu_destroy(ShopMenu)    // line 2100
        
return PLUGIN_HANDLED
    } 

        
// .....

What may cause it...? is there anything I could add to the if() maybe that'll prevent it? And is this type of error causing server crash?
__________________
My Projects:

Auto-Mix (Pug): 100%

Joined the Military (a soldier now) - Inactive
Diegorkable is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-11-2011 , 09:39   Re: [RUNTIME ERROR] Invalid menu id 40(42)
Reply With Quote #2

If you're making a menu global, don't destroy it.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 11-11-2011 , 10:56   Re: [RUNTIME ERROR] Invalid menu id 40(42)
Reply With Quote #3

So what should if menu == item_Exit? just return PLUGIN_HANDLED?
__________________
My Projects:

Auto-Mix (Pug): 100%

Joined the Military (a soldier now) - Inactive
Diegorkable is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-11-2011 , 11:10   Re: [RUNTIME ERROR] Invalid menu id 40(42)
Reply With Quote #4

Do everything like you always do, return when item == MENU_EXIT.
Just don't use menu_destroy(iMenu); when you're using a global menu.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 11-11-2011 , 11:34   Re: [RUNTIME ERROR] Invalid menu id 40(42)
Reply With Quote #5

So when do I use a menu_destroy and why would I want to use that?
__________________
My Projects:

Auto-Mix (Pug): 100%

Joined the Military (a soldier now) - Inactive
Diegorkable is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-11-2011 , 11:58   Re: [RUNTIME ERROR] Invalid menu id 40(42)
Reply With Quote #6

You use menu_destroy to free the resources for that menu. If you have a menu that will never change and can be accessed any time, then you can create a global to store the menu, and then never destroy it. (Note that the menu is destroyed at map change)
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
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 14:15.


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