Raised This Month: $ Target: $400
 0% 

access level problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
beBoss
New Member
Join Date: Aug 2010
Location: In her heart
Old 08-15-2010 , 10:06   access level problem
Reply With Quote #1

Hi guys. It's my first post here and I'm little uneasy. I'm trying to create a slaymenu, but I can't make it for admins only (access level 3). Ok I'm using kickmenu code from this forum (code from somebody here) and I can't make it to works only for admins ! I don't know why but if write the commnand amx_slaymenu and I'm not admin show me in console "you don't have an access to this command" (or something like this) and it's shows the menu... If I'm admin, doesn't show the message, but doesn't show the menu too, pff. I'm little confused about this. So I need you help :]] The code is not very good, but I think with your help I'll optimize it

p.s. I'm sorry about my poor english, but isn't my native !

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >

#define PLUGIN "SlayMenu"
#define VERSION "5.1"
#define AUTHOR "beBoss"


new p_menu


public plugin_init( ) 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd"amx_slaymenu""showmenu"ADMIN_SLAY );
}

    
// beBoss CallBack
public beBossCallback(idMenuitem

    return 
get_pcvar_nump_menu ) ? ITEM_ENABLED ITEM_DISABLED
}

//public AccsessMenu( const id, const level, const cid )
//{
//    if( cmd_access( id, level, cid, 3 ) ) 
//        showmenu( id );
//
//}

public showmenu( const id, const level, const cid )
{
    if( !
cmd_accessidlevelcid3) )
        return 
PLUGIN_HANDLED;
    
    new 
menu menu_create"\yChoose a player to slay:""submenu" );

    new 
players32 ], pnumtempid;
    new 
szName32 ], szTempid10 ];

    
get_playersplayerspnum"a" );

    
p_menu register_cvar("p_menu""0")
    
    for( new 
iipnumi++ )
    {
        
tempid players];
        
        
get_user_nametempidszName31 );
        
num_to_strtempidszTempid);
        
    
    if( !
is_user_admintempid ) ) { 
        
menu_additem(menuszNameszTempid0// if isn't admin = enabled
    
} else { 
        
menu_additem(menuszNameszTempid0menu_makecallback("beBossCallback")) // if is admin = disabled
    
}
    }
    
    
menu_displayidmenu );
    return 
PLUGIN_HANDLED;
    
}


    
public 
submenu( const id, const menu, const item )
{    
// ако е натиснато 0
    
if( item == MENU_EXIT )
    {
        
menu_destroymenu );
        return 
PLUGIN_HANDLED;
    }

    new 
data], iName64 ];
    new 
accesscallback;
    
menu_item_getinfomenuitemaccessdata,5iName63callback );

    new 
tempid str_to_numdata );

    if( !
is_user_admintempid ) )
        
user_killtempid );
    
    
menu_destroymenu );
    return 
PLUGIN_HANDLED;

__________________

Last edited by beBoss; 08-15-2010 at 10:11.
beBoss 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 21:55.


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