Raised This Month: $ Target: $400
 0% 

Disable items in the menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-29-2009 , 00:33   Disable items in the menu
Reply With Quote #1

Hi, i want to know the better way to block options in the menu... this is my way:

PHP Code:
#include <amxmodx>

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

new p_test

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /test""TestMenu")
    
    
p_test register_cvar("menu_test""0")
}

public 
TestMenu(id)
{
    new 
Menu menu_create("\yTest Menu""test_show")
    
    
menu_additem(Menu"\wTest 1""1"0)
    
menu_additem(Menu"\wTest 2""2"0)
    
    if(
get_pcvar_num(p_test) )
        
menu_additem(Menu"\dTest 3""3", -1)
    else
        
menu_additem(Menu"\wTest 3""3"0)
    
    
menu_setprop(Menu,MPROP_EXITNAME,"Salir")
    
menu_setprop(MenuMPROP_EXITMEXIT_ALL)
    
    
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:
        {
            if(
get_pcvar_num(p_test) )
                
menu_display(idMenu0)
            else
                
client_print(idprint_chat"test 3")
        }
    }
    return 
PLUGIN_HANDLED

is there another better way?
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
 


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


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