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

Pass some arguments in new menu system


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jon
Veteran Member
Join Date: Dec 2007
Old 12-08-2008 , 11:27   Pass some arguments in new menu system
Reply With Quote #1

How can you pass arguments in the new menu system without using globals? :
Code:
#include <amxmodx> public menu ( param[1] ) {     new iMenu = menu_create ( "Test", "handler" )             menu_additem ( iMenu, "Test", "1" )     menu_display ( id, iMenu )         // PASS PARAM[0] AND PARAM[1] INTO THE HANDLER ??             return PLUGIN_HANDLED }     /* - - - - - - - */     public handler ( id, iMenu, iItem ) {     if ( iItem == MENU_EXIT )     {         menu_destroy ( iMenu )         return PLUGIN_HANDLED     }             new iAccess, iCallback, sData[33], sName[65]     menu_item_getinfo( iMenu, iItem, iAccess, sData, 32, sName, 64, iCallback )     new iKey = str_to_num ( sData )         // need two indexes :(         return PLUGIN_HANDLED }
Jon is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-08-2008 , 11:53   Re: Pass some arguments in new menu system
Reply With Quote #2

You can pass the parameters into the info.

Code:
#include <amxmodx> public menu ( param[1] ) {     new iMenu = menu_create ( "Test", "handler" )             menu_additem ( iMenu, "Test", "1 ^"data 1^" ^"data 2^"" )     menu_display ( id, iMenu )             return PLUGIN_HANDLED }     /* - - - - - - - */     public handler ( id, iMenu, iItem ) {     if ( iItem == MENU_EXIT )     {         menu_destroy ( iMenu )         return PLUGIN_HANDLED     }             new iAccess, iCallback, sData[33], sName[65]     menu_item_getinfo( iMenu, iItem, iAccess, sData, 32, sName, 64, iCallback )         new sKey[4], sData1[16], sData2[16];     parse(sData, sKey, 3, sData1, 15, sData2, 15);         new iKey = str_to_num(sKey);         // need two indexes :(     new index1 = str_to_num(sData1);     new index2 = str_to_num(sData2);         return PLUGIN_HANDLED }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 12-09-2008 , 08:16   Re: Pass some arguments in new menu system
Reply With Quote #3

Thanks, never thought about that.

Last edited by Jon; 12-09-2008 at 08:45.
Jon is offline
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 16:07.


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