Raised This Month: $ Target: $400
 0% 

Menus


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-17-2012 , 15:01   Menus
Reply With Quote #1

Can someone show me how to write a menu? AMX documentation looks outdated. I used AMXX-Studio's Menu Generator and that just confused me more....

so far i have....
Code:
public cmdAdminMenu(id, level, cid)
{
	if(!cmd_access(id, level, cide, 1))
		return PLUGIN_HANDLED
	/* Menu BKF Admin */
	/* Use menu_display(id, mBKFAdmin, 0) to show the menu to an user. */
	m_adminMenu = menu_create("BKF Admin", "mh_BKFAdmin")
	menu_additem(a_adminMenu, "Set Player Level", "1", ADMIN_KICK)
	menu_additem(a_adminMenu, "Set Player Frags", "ma_BKFAdmin", ADMIN_KICK, mcbBKFAdmin)
	menu_additem(a_adminMenu, "Give Player Frags", "ma_BKFAdmin", ADMIN_KICK, mcbBKFAdmin)
	menu_additem(a_adminMenu, "Prune Vault", "ma_BKFAdmin", ADMIN_BAN, mcbBKFAdmin)
	menu_additem(a_adminMenu, "Set CVARs", "ma_BKFAdmin", ADMIN_CFG, mcbBKFAdmin)
	/* Menu End */

	menu_display(id, a_adminMenu, 0)
	return PLUGIN_HANDLED
}

public mh_BKFAdmin(id, menu, item) 
{
	switch(item)
	{
		case 0:
			// is that how it works?
		default:
			menu_destroy()
			
	}
	return PLUGIN_HANDLED
}

public ma_BKFAdmin(id) {
	/* This event is called when an item was selected */
}
public mcb_BKFAdmin(id, menu, item) {
	/* This is the callback-event, here you can set items enabled or disabled. */
	/* If you want to enable an item, use: return ITEM_ENABLED */
	/* If you want to disable an item, use: return ITEM_DISABLED */
}
I called cmdAdminMenu from client_concmd(\\stuffs)
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz 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 00:19.


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