Quote:
Originally Posted by DPT
PHP Code:
register_concmd("amx_test","cmdTest",ADMIN_BAN & ADMIN_LEVEL_H & ADMIN_LEVEL_G)
|
This won't let anyone access anything.
Quote:
Originally Posted by DPT
PHP Code:
register_concmd("amx_test","cmdTest",ADMIN_BAN|ADMIN_LEVEL_H|ADMIN_LEVEL_G)
|
This will allow anyone with ADMIN_BAN
or ADMIN_LEVEL_H
or ADMIN_LEVEL_G access the command.
If you want to require
all of the flags to access the command you can use this version of cmd_access() with the second version of register_concmd() that you posted.
PHP Code:
stock cmd_access_require_all(id, level, cid, num, bool:accesssilent = false)
{
new has_access = 0;
if ( id==(is_dedicated_server()?0:1) )
{
has_access = 1;
}
else if ( level==ADMIN_ADMIN )
{
if ( is_user_admin(id) )
{
has_access = 1;
}
}
else if ( get_user_flags(id) & level == level )
{
has_access = 1;
}
else if (level == ADMIN_ALL)
{
has_access = 1;
}
if ( has_access==0 )
{
if (!accesssilent)
{
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("You have no access to that command."));
#else
console_print(id,"%L",id,"NO_ACC_COM");
#endif
}
return 0;
}
if (read_argc() < num)
{
new hcmd[32], hinfo[128], hflag;
get_concmd(cid,hcmd,31,hflag,hinfo,127,level);
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("Usage: %s %s"), hcmd, SIMPLE_T(hinfo));
#else
console_print(id,"%L: %s %s",id,"USAGE",hcmd,hinfo);
#endif
return 0;
}
return 1;
}
__________________