Raised This Month: $ Target: $400
 0% 

[SOLVED] menu callback trouble


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 01-03-2013 , 21:18   [SOLVED] menu callback trouble
Reply With Quote #1

ive got the callback working for admin check... its disabled when your not admin....

but when player is ALIVE it still shows menu item in white and showing enabled....

PHP Code:
public Revive_callback(idDM_Menuitem)
{
    new 
data[6], szName[64];
    new 
accesscallback;
    

    
menu_item_getinfo(DM_Menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);

    new 
tempid str_to_num(data);
    
    if( !
is_user_alivetempid ) )
    {
        return 
ITEM_ENABLED;
    }    

    return 
ITEM_DISABLED;

this is the menu and handler

PHP Code:
public DM_MainMenu(id)
{
    new 
DM_Menu menu_create("\rDeathMatch Main Menu:^n\yMade By Blizzard""DM_MainMenu_Handler");
    
    
    
menu_additem(DM_Menu"Change Team""1");
    
menu_additem(DM_Menu"Re-Enable Class Menu""2");
    
menu_additem(DM_Menu"Class Information^n""3");
    
menu_additem(DM_Menu"Respawn""4"0g_ReviveCallback);
    
menu_additem(DM_Menu"Admin Menu""5"0g_AdminCallback);
    
    
    
menu_setprop(DM_MenuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idDM_Menu);
    
    return 
PLUGIN_HANDLED;
    
}

public 
DM_MainMenu_Handler(idDM_Menuitem)
{
    if( 
item == MENU_EXIT )
    {        
        
Check_No_Class(id);
                    
        
menu_destroy(DM_Menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], szName[64];
    new 
accesscallback;
    
    
menu_item_getinfo(DM_Menuitemaccessdatacharsmax(data), szNamecharsmax(szName), callback);
    
    new 
key str_to_num(data);
    
    switch( 
key )
    {
        case 
1// Change Team Menu
        
{
            
Change_Team_Menu(id);
        }
        
        case 
2// Re-Enable Class Menu
        
{
            
client_cmd(id"enable");
            
Check_No_Class(id);
        }
        
        case 
3// Class Information
        
{
            
client_cmd(id"ClassInfo");
            
Check_No_Class(id);
        }
        
        case 
4:
        {
            if(!
is_user_alive(id))
            {
                
ExecuteHamB(Ham_CS_RoundRespawnid);
            }
            
            
Check_No_Class(id);
        }
        case 
5:
        {
            
Show_Admin_Menu(id);
        }
        
    }
    
    
    
menu_destroy(DM_Menu);    
    return 
PLUGIN_HANDLED;

i cant find what ive done wrong since ive made sure to do it all correct from the TUT.

Last edited by Blizzard_87; 01-04-2013 at 07:18.
Blizzard_87 is offline
 


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 13:44.


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