> > > >

cmd_access | amxmisc | AMX X Documentation

Includes

    1. Stocks
    1. Natives
    2. Forwards
    1. Natives
    2. Stocks
    1. Natives
    2. Stocks
    1. Natives
    1. Natives
    2. Stocks
    1. Natives
    1. Natives
    2. Forwards
    3. Stocks
    1. Natives
    2. Forwards
    1. Natives
    1. Natives
    1. Natives
    2. Stocks
    1. Natives
    2. Forwards
    1. Natives
    1. Natives
    2. Forwards
    1. Natives
    2. Forwards
    1. Stocks
    1. Natives
    1. Natives
    2. Stocks
    1. Stocks
    1. Stocks
    1. Natives
    1. Natives
    2. Forwards
    3. Stocks
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    2. Stocks
    1. Natives
    1. Natives
    1. Stocks
    1. Natives
    1. Natives
    1. Natives
    2. Forwards
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    2. Forwards
    1. Natives
    2. Stocks
    1. Natives
    1. Natives
    1. Natives
    2. Stocks
    1. Natives
    1. Stocks
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    2. Forwards
    3. Stocks
    1. Stocks
    1. Natives
    2. Forwards
    3. Stocks
    1. Natives
    1. Natives
    2. Forwards
    3. Stocks
    1. Natives
    1. Natives
    2. Stocks
    1. Stocks

cmd_access

Syntax
									stock cmd_access(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)
     {
          has_access = 1;
     }
     else if (level == ADMIN_ALL)
     {
          has_access = 1;
     }

     if (has_access == 0)
     {
          if (!accesssilent)
          {
               console_print(id, "%L", id, "NO_ACC_COM");
          }
          return 0;
     }
     if (read_argc() < num)
     {
          new hcmd[32], hinfo[128], hflag, bool:info_ml;
          get_concmd(cid, hcmd, charsmax(hcmd), hflag, hinfo, charsmax(hinfo), level, _, info_ml);

          if (info_ml)
          {
               LookupLangKey(hinfo, charsmax(hinfo), hinfo, id);
          }

          console_print(id, "%L:  %s %s", id, "USAGE", hcmd, hinfo);
          return 0;
     }

     return 1;
}
								
Variable Description
id
Client index
level
Required admin flags
cid
Command id
num
Required number of parameters
acesssilent
If true no denied access message will be printed

Description
Returns if the user can execute the current command by checking the necessary admin flags and parameter count. Displays a denied access message to the user if missing privileges or a usage example if too few parameters are provided.

Note
This should be used inside of a command forward as it uses read_argc()
to check the parameter count.

Return
1 if access granted and parameters provided, 0 otherwise
> > > >