Raised This Month: $ Target: $400
 0% 

Invalid menu id


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 07-14-2008 , 16:00   Invalid menu id
Reply With Quote #1

Hi !

I got errors with my plugins, and it's invalid menu id.
I can't find any information about the error.

I guess it's because its wrong id "selected". For example you want
to show a menu, the id is 3 but for some reason 'menu_display' sends id 0.

So I want to know exactly how to fix the error, or what's making it and
what the error means. I'm sure it's different from plugin to plugin.

But just a definiton of it and what's creating it. If I need to post my
script and show just ask.
Quote:
Invalid menu id 0(3)
[AMXX] Run time error 10: native error (native "menu_display")
[AMXX] [0] menus.inl::cpm_menu (line 126)
[AMXX] [1] menus.inl::point_handler (line 94)
__________________
atomen is offline
Send a message via MSN to atomen
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 07-15-2008 , 06:34   Re: Invalid menu id
Reply With Quote #2

I'll post the code to make it clearer :
Code:
public cpm_menu(id) {     if(TotalModels > 0)     {         if(fm_get_user_team(id) == CS_TEAM_CT)             menu_display(id, menu_id_model_ct, 0);         else if(fm_get_user_team(id) == CS_TEAM_T)             menu_display(id, menu_id_model_t, 0); // This is where the error is     }     return 1; }
Code:
public point_handler(id, menu, item) {     if(item == MENU_EXIT)     {         menu_destroy(menu);         return 1;     }     new data[6], name[64];     new access, callback;     menu_item_getinfo(menu, item, access, data, 5, name, 63, callback);     new key = str_to_num(data);     switch(key)     {         case 1: show_points(id);         case 2: db_handle(id);         case 3:         {             if(!get_status(id, 1))                 vip_handle(id);             else if(get_status(id, 1))                 vip_menu(id);         }         case 4: cpm_menu(id); // This is where the second error is         case 5:         {             if(!get_status(id, 3))                 mr_handle(id);             else if(get_status(id, 3))                 mr_menu(id);         }         case 6:         {             if(!get_status(id, 4))                 vmr_handle(id);             if(get_status(id, 4))                 vmr_menu(id);         }         case 7: sam_handle(id);         case 8: cm_handle(id);     }     menu_destroy(menu);     return 1; }
__________________

Last edited by atomen; 07-15-2008 at 06:36.
atomen is offline
Send a message via MSN to atomen
jim_yang
Veteran Member
Join Date: Aug 2006
Old 07-15-2008 , 09:56   Re: Invalid menu id
Reply With Quote #3

did you destroy the menu_id_model_t ?
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 07-15-2008 , 10:29   Re: Invalid menu id
Reply With Quote #4

The menu works the first time, but if I try to use it again the menu locks and the error occurs even if I choose menu option 0 (exit).
Code:
  public cpm_models(id, menu, item) {     if(item == MENU_EXIT || !is_user_connected(id))     {         menu_destroy(menu); // Here         return 1;     }     new model_name[41];     new access, callback;     menu_item_getinfo(menu, item, access, model_name, 40, "", 0, callback);     log_ps("Model Name : %s", model_name);     cpm_handle(id, model_name);     menu_destroy(menu); // Here     return 1; }
__________________

Last edited by atomen; 07-15-2008 at 10:39.
atomen is offline
Send a message via MSN to atomen
jim_yang
Veteran Member
Join Date: Aug 2006
Old 07-15-2008 , 21:30   Re: Invalid menu id
Reply With Quote #5

I don't know where you created your model menu, but it seems they are created at plugin start. I assume menu_id_model_t is a global variable
when you destroy the menu, menu_id gone. which means you need to create the menu again when you need it.
So if the model menu is global (static), do not destroy it
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 07-16-2008 , 04:41   Re: Invalid menu id
Reply With Quote #6

It's ok, I got help from Emp and fixed the menu.
I fixed it the same way as you posted.

I created the menu non-global.
__________________
atomen is offline
Send a message via MSN to atomen
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 05:36.


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