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

menu_item_getinfo function problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 05-06-2014 , 04:59   menu_item_getinfo function problem
Reply With Quote #1

In "my" version of CSDM (latest version called as 2.1.3c) I'm using couple of menus to let the user/admin change setting via them.
One of such menus is CSDM Settings Menu.
This is the part of code to invoke/use it:
Code:
public plugin_init()
{
(...)
	register_clcmd("csdm_menu", "csdm_menu", ADMIN_MENU, "CSDM Menu")
	register_clcmd("csdm_sett_menu", "csdm_sett_menu", ADMIN_MENU, "CSDM Settings Menu")
	register_clcmd("csdm_main_sett_menu", "csdm_main_sett_menu", ADMIN_MENU, "CSDM Main Settings Menu")
(...)
	AddMenuItem("CSDM Menu", "csdm_menu", D_ACCESS, D_PLUGIN)
	g_MainMenu = menu_create("CSDM Menu", "use_csdm_menu")
(...)
	g_SettingsMenu = menu_create("CSDM Settings Menu", "use_csdm_sett_menu")
(...)
	menu_additem(g_MainMenu, "CSDM Settings", "csdm_sett_menu", D_ACCESS)
(...)
}

public csdm_menu(id, level, cid)
{
	if (!cmd_access(id, level, cid, 1))
		return PLUGIN_HANDLED
	
	menu_display(id, g_MainMenu, 0)
	
	return PLUGIN_HANDLED
}

public csdm_sett_menu(id, level, cid)
{
	if (!cmd_access(id, level, cid, 1))
		return PLUGIN_HANDLED
	
	menu_display(id, g_SettingsMenu, 0)

	return PLUGIN_HANDLED
}

public use_csdm_menu(id, menu, item)
{
	if (item < 0)
		return PLUGIN_CONTINUE
	
	new command[24], paccess, call
	if (!menu_item_getinfo(g_MainMenu, item, paccess, command, 23, _, 0, call))
	{
		log_amx("Error: csdm_menu_item() failed (menu %d) (page %d) (item %d)", g_MainMenu, 0, item)
		return PLUGIN_HANDLED
	}
	if (paccess && !(get_user_flags(id) & paccess))
	{
		client_print(id, print_chat, "You do not have access to this menu option.")
		return PLUGIN_HANDLED
	}
	
	client_cmd(id, command)
	
	return PLUGIN_HANDLED
}

public use_csdm_sett_menu(id, menu, item)
{
	if (item < 0)
		return PLUGIN_CONTINUE
	
	new command[24], paccess, call
	if (!menu_item_getinfo(g_SettingsMenu, item, paccess, command, 23, _, 0, call))
	{
		log_amx("Error: csdm_menu_item() failed (menu %d) (page %d) (item %d)", g_SettingsMenu, 0, item)
		return PLUGIN_HANDLED
	}
	if (paccess && !(get_user_flags(id) & paccess))
	{
		client_print(id, print_chat, "You do not have access to this menu option.")
		return PLUGIN_HANDLED
	}

	client_cmd(id, command)

	return PLUGIN_HANDLED
}
I don't know exactly when, but it stopped to work with displaying CSDM Settings Menu and the user gets the info in the console "Server tried to send invalid command:"csdm_sett_menu " (many spaces next to csdm_sett_menu then qutoes - I cannot show it here exactly how does it look like in the console).
It was working for sure with AMXMODX 1.8.0 version, but it stopped probably with 1.8.2 (for both - CS1.6/CZERO). It looks like the function "menu_item_getinfo" started working a bit different way, beacuse if I'm shorting the name of my command "csdm_sett_menu" to for example "csdm_smenu" (in all paces of above code) it works again. The change of the string length of "command" didn't help even if I doubled it.
Dunno if this is the bug in the function "menu_item_getinfo" or I should rewrite some of my plugins to get them working again. But what about the compatibility with oldest AMXX versions?
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.

Last edited by KWo; 05-06-2014 at 05:02.
KWo is offline
 



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:52.


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