Raised This Month: $ Target: $400
 0% 

access level problem


Post New Thread Reply   
 
Thread Tools Display Modes
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
SaM.ThE.MaN
Senior Member
Join Date: Jan 2010
Old 08-15-2010 , 15:45   Re: access level problem
Reply With Quote #2

when ur not an admin .. it says u dont have access to this command ... and am kinda busy to help u with the other part , anyways i kinda forgot 90% of what i really knew cause i was away for 2 months
__________________
  • Project : Level Plugin
o [||||||||||] - 100%
  • Project : OnePieceMod
o [||||||||||] - 20%
SaM.ThE.MaN is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-15-2010 , 17:34   Re: access level problem
Reply With Quote #3

You need to understand what that 3 does. It says that it needs three arguments (including the command name). So, you should only have a 1 there. So, if you just type in "amx_slaymenu" in your console it shouldn't show it to anyone.

ADMIN_SLAY is the access level that the function is using.
__________________
fysiks is offline
beBoss
New Member
Join Date: Aug 2010
Location: In her heart
Old 08-16-2010 , 07:07   Re: access level problem
Reply With Quote #4

Ok, thanks for your help. Another question:

Quote:
Warning: Loose indentation on line 30
What does it mean ?

PHP Code:
25 public beBossMenu( const id, const level, const cid )
26 {
27    if( !cmd_accessidlevelcid1) )
28        return PLUGIN_HANDLED;
29    
30    
new menu menu_create"\yChoose a player to slay:""beBossSubMenu" );
31
32    
new players32 ], pnumtempid;
33    new szName32 ], szTempid10 ];
34
35    get_players
playerspnum"a" );
36
37    b_menu 
register_cvar("b_menu""0"); // for CallBack 
__________________
beBoss is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 08-16-2010 , 07:12   Re: access level problem
Reply With Quote #5

Its nothing to worry about.It doesnt affect the code.If your using amxx editor CTRL+I to use the Indenter tool.
SpeeDeeR is offline
beBoss
New Member
Join Date: Aug 2010
Location: In her heart
Old 08-16-2010 , 07:31   Re: access level problem
Reply With Quote #6

Thank you SpeeDeeR. With Ctrl+I everything came to the place! By the way Благодаря !
__________________
beBoss is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-16-2010 , 07:44   Re: access level problem
Reply With Quote #7

You should not rely on such tool if you don't understand what mean indentation. http://en.wikipedia.org/wiki/Indent_style
__________________
Arkshine is offline
beBoss
New Member
Join Date: Aug 2010
Location: In her heart
Old 08-16-2010 , 08:04   Re: access level problem
Reply With Quote #8

I understand it very well. I have experience in programming, just dоn't know that, the software has this option!
__________________
beBoss 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 21:55.


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