Raised This Month: $ Target: $400
 0% 

Disable items in the menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
zwfgdlc
Senior Member
Join Date: May 2006
Old 07-29-2009 , 03:49   Re: Disable items in the menu
Reply With Quote #6

create a callback function for menu.

like this,not tested.
PHP Code:
#include <amxmodx>

#define PLUGIN    "Test Menu"
#define AUTHOR    "Alucard"
#define VERSION    "1.0"

new p_test
new MenuCallback;
new 
menu;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /test""TestMenu")
    
    
p_test register_cvar("menu_test""0")
    
    
Menu menu_create("\yTest Menu""test_show")
    
MenuCallback menu_makecallback("menu_callback");
    
    
menu_additem(Menu"\wTest 1""1"0,MenuCallback)
    
menu_additem(Menu"\wTest 2""2"0,MenuCallback)
    
menu_additem(Menu"\dTest 3""3", -1,MenuCallback)
    
menu_setprop(Menu,MPROP_EXITNAME,"Salir")
    
menu_setprop(MenuMPROP_EXITMEXIT_ALL)
}

public 
TestMenu(id)
{
    
menu_display(idMenu0)
    
    return 
PLUGIN_HANDLED
}

public 
test_show(idMenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6]
    new 
iAccess
    
new iCallback
    
new iName[64]
    
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback)
    
    switch(
str_to_num(iData))
    {
        case 
1:
        {
            
client_print(idprint_chat"test 1")
        }
        case 
2:
        {
            
client_print(idprint_chat"test 2")
        }
        case 
3:
        {
            
client_print(idprint_chat"test 3")
        }
    }
    return 
PLUGIN_HANDLED
}  


public 
menu_callback(idMenuitem)
{
    if(
item == 2)
    return 
get_pcvar_num(p_test) ? ITEM_DISABLED ITEM_ENABLED;

zwfgdlc 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 18:29.


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