AMX Mod X API Documentation

Signature
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;}
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.

Notes
  • This should be used inside of a command forward as it uses read_argc()

    to check the parameter count.

Parameters
  • 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
Returns

1 if access granted and parameters provided, 0 otherwise

Назад
Верх