Raised This Month: $2 Target: $400
 0% 

Note to plugin authors: Add custom menu items to amxmodmenu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 10-08-2004 , 04:44   Note to plugin authors: Add custom menu items to amxmodmenu
Reply With Quote #1

With an updated amxmisc.inc and menufront.sma there is now a new stock function to add custom menu items to the Menus Front-End plugin like this:

Code:
/* Add a menu item to Menus Front-End plugin: * MENU_TEXT: Text that will be shown for this item in menu * MENU_CMD: Command that should be executed to start menu * MENU_ACCESS: Access required for menu * MENU_PLUGIN: The exact case-insensitive name of plugin holding the menu command */ stock AddMenuItem(const MENU_TEXT[], const MENU_CMD[], const MENU_ACCESS, const MENU_PLUGIN[])

Oh and the limit of items in the menu is currently 128.


Example use in my Weapon Arena plugin that has a menu which is called with command "weaponarena_menu":

Code:
    // Add menu item to menufront AddMenuItem("Weapon Arena", "weaponarena_menu", ACCESSNEEDED, PLUGINNAME)
Johnny got his gun is offline
Infra
Senior Member
Join Date: Aug 2004
Location: California
Old 10-08-2004 , 13:02  
Reply With Quote #2

Does the case sensitive plugin name include the ".amx" (name of file), or is it what you have named the plugin in the register_plugin command?
__________________
--Infra
Infra is offline
Send a message via AIM to Infra
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 10-08-2004 , 13:21  
Reply With Quote #3

It's insensitive and it's the name used with the register_plugin function.
Johnny got his gun is offline
Infra
Senior Member
Join Date: Aug 2004
Location: California
Old 10-09-2004 , 12:46  
Reply With Quote #4

Thanks ^_^
__________________
--Infra
Infra is offline
Send a message via AIM to Infra
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 10-13-2004 , 16:43  
Reply With Quote #5

Added a file configs/custommenuitems.cfg

It looks like this:

Quote:
// Here you can add menu items from any plugin to Menus Front-End plugin, aka "amxmodmenu".
//
// Usage: "amx_addmenuitem <menu text> <menu command> <access flags> <plugin name>"
//
// <menu text>: This is the text displayed in the menu itself for this item.
// <menu command>: This is the client command used to access the menu.
// <access flags>: Specify what access flags admins must have to use this menu item. (Check users.ini for access flags.)
// <plugin name>: This must be the _exact_ (though case insensitive) name of the plugin which holds the menu command. (Use "amxx plugins" in server console, plugin names are listed in Name column.)
//
// Example: (be sure to use quotes around parameters with spaces!)
//
// amx_addmenuitem "Weapon Arena" "weaponarena_menu" "hu" "Weapon Arena"
You can get it from CVS right away (actually you can create it yourself, it's just a cfg file). Just be sure to also get+compile menufront.sma from CVS.

For playing with my CZERO server I added this, showing it to you as another example:

Quote:
amx_addmenuitem "CZ Bots" "amx_czbotmenu" "hu" "CZ Bot control"
amx_addmenuitem "CZ Bots Weapon Restriction" "amx_czbotmenuwr" "hu" "CZ Bot control"
These are menus from the "CZ Bot control" plugin released by EKS.
Johnny got his gun is offline
FullThrottle
Member
Join Date: Oct 2004
Old 10-13-2004 , 19:16  
Reply With Quote #6

Very nice JGHG! A much needed and I'm sure will be a much appreciated improvement.
FullThrottle is offline
hazz
Member
Join Date: May 2006
Old 07-30-2006 , 09:46   Re: Note to plugin authors: Add custom menu items to amxmodmenu
Reply With Quote #7

I don't get it... I need to add options to put noclip and godmode on players. Of corse that means I need a menu for each one. (http://forums.alliedmods.net/showthread.php?t=23213). Can someone make that for me please?
hazz is offline
TheNewt
Donor
Join Date: Jun 2006
Location: Where I live.
Old 07-31-2006 , 13:44   Re: Note to plugin authors: Add custom menu items to amxmodmenu
Reply With Quote #8

1) Nice bump
2) You wish to add noclip and godmode to the amxmodmenu as menus? Inside the menus you want playernames or something?
__________________
Quote:
toe3_ left the chat room. (G-lined (AUTO Excessive connections from a single host.))
TheNewt is offline
popeye10
Senior Member
Join Date: May 2014
Location: Navi Mumbai (India)
Old 05-31-2014 , 15:48   Re: Note to plugin authors: Add custom menu items to amxmodmenu
Reply With Quote #9

how to add Screenshot/snapshot menu in amxmodmenu ?
popeye10 is offline
Reply


Thread Tools
Display Modes

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 08:57.


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