AlliedModders (
-   Suggestions / Requests (
-   -   [HOWTO] Change the admin level of commands yourself (

v3x 05-12-2008 05:31

[HOWTO] Change the admin level of commands yourself
I figured I'd post/sticky this here because I noticed a lot of people requesting that someone change the access level of a command inside a plugin for them.

If you're using AMX Mod X 1.8.0+:

Originally Posted by AMX Mod X 1.8.0 Changes
You can now change the access flags required by commands without recompiling or editing scripts. AMX Mod X caches all command flags in configs/cmdaccess.ini, where they can be easily edited.
A few notes:
  • To disable this feature for a single command in the ini file, set it's access flag in the ini file to "*"
  • To disable this feature entirely, change "disableflagman 0" in core.ini to be "disableflagman 1"
  • In the default state, the flag manager will try to guess which commands should be excluded. The rules are as follows:
    • All commands with the default access (-1, not ADMIN_ALL) are not included
    • All commands that begin with "say" are not included
    • To disable flagmanager for storing commands from inside of the plugin, set the new 5th parameter of register_clcmd or register_concmd to 0.
    • To tell flagmanager to always store your command, even if the filter would have ruled it out set the 5th parameter to 1.
    • The default value of this new 5th parameter is -1, this means it will treat it as if the parameter did not exist.
    • Note: Even if a plugin exclusively tells flagmanager to hide the command, the admin can insert it into cmdaccess.ini and it will be used.
Also, changes to access will not take effect until a map change. Additionally, the automatic writing of newly detected commands does not occur until map change.

If you're using a version prior to 1.8.0:

Open the plugin, scroll down until you see "public plugin_init()." Inside of there you will notice register_clcmd or register_concmd. In those lines you'll see the access level in the third parameter (ADMIN_KICK or whatever it'd be). Simply change that to the one of your choice.

Here are the admin level constants:

#define ADMIN_ALL 0 //Everyone
#define ADMIN_IMMUNITY 1 //Flag "a", immunity
#define ADMIN_RESERVATION 2 //Flag "b", reservation
#define ADMIN_KICK 4 //Flag "c", kick
#define ADMIN_BAN 8 //Flag "d", ban
#define ADMIN_SLAY 16 //Flag "e", slay
#define ADMIN_MAP 32 //Flag "f", map change
#define ADMIN_CVAR 64 //Flag "g", cvar change
#define ADMIN_CFG 128 //Flag "h", config execution
#define ADMIN_CHAT 256 //Flag "i", chat
#define ADMIN_VOTE 512 //Flag "j", vote
#define ADMIN_PASSWORD 1024 //Flag "k", sv_password
#define ADMIN_RCON 2048 //Flag "l", rcon access
#define ADMIN_LEVEL_A 4096 //Flag "m", custom
#define ADMIN_LEVEL_B 8192 //Flag "n", custom
#define ADMIN_LEVEL_C 16384 //Flag "o", custom
#define ADMIN_LEVEL_D 32768 //Flag "p", custom
#define ADMIN_LEVEL_E 65536 //Flag "q", custom
#define ADMIN_LEVEL_F 131072 //Flag "r", custom
#define ADMIN_LEVEL_G 262144 //Flag "s", custom
#define ADMIN_LEVEL_H 524288 //Flag "t", custom
#define ADMIN_MENU 1048576 //Flag "u", menus
#define ADMIN_ADMIN 16777216 //Flag "y", default admin
#define ADMIN_USER 33554432 //Flag "z", default user
Once you've done that, either compile the plugin locally, or use the web compiler.

You're done.

All times are GMT -4. The time now is 07:35.

Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.