This plugin provides one command, sm_flags, with a default access requirement of ROOT, which can be used to temporarily customize a client's access flags for the duration of their connection to the server. This plugin is loosely based off of Niggy's Session Flags.
The syntax of the command is as follows:
sm_flags <target> <+/-/%/=/_> <flags>
The first argument is simply the clients that you want to use the command on. The plugin uses ProcessTargetString, and therefore supports targeting by name, SteamID, userID, @all, @!me, etc.
The second argument is the operator. This tells the plugin what you want to do with the specified flags. More on this later. If you skip this argument and go right on to the third one, the plugin will assume that you meant to put a + symbol.
The third argument is simply a list of flags that you want to affect. With one exception, the command user can never affect a flag that he himself does not have access to. (Of course, root users are considered to have all flags.) Rather than type out all 21 flag letters, you can type the @ symbol here to quickly indicate that you wish to affect all flags.
The operators function as follows:
+ adds the flags specified. For example, if someAdmin used this command:
sm_flags somePlayer + abcdefg
The above command would give the somePlayer player the a, b, c, d, e, f, and g flags. If somePlayer already had one of those flags, that flag is not touched. Further, if the command user doesn't himself have access to one of those flags, then the flag will not be changed for somePlayer.
If you leave off the operator from the command, and instead put flags right after the target argument, the plugin will assume that you want to add flags.
- removes the flags specified. For example:
sm_flags somePlayer - @
The above command would remove all flags from somePlayer, leaving him with no flags. If somePlayer had flags that someAdmin did not, somePlayer will keep those flags.
% toggles the flags specified. For example:
sm_flags somePlayer % opqrst
The above command would toggle all the CUSTOM# flags on somePlayer. The flags he had, he will no longer have, and he will gain the flags he did not have. If someAdmin did not have access to one of these flags, then that flag will not be changed for somePlayer.
= sets the flags on the target user to whatever has been specified. For example:
sm_flags somePlayer = aopqrst
The above command would first remove all flags from somePlayer that someAdmin also had access to, and then give somePlayer the reserved slot and all CUSTOM# flags, assuming that someAdmin also had access to these flags.
When using this operator, putting "0" for the flags will indicate that you want to remove all flags; this is the same as using @ with -
_ resets the flags on the target user to how they were just before this command was first used on them.
For example, let's say that somePlayer joins the server with the flags "abcopqr". Whenever any admin uses one of the previous operators on somePlayer, the plugin will save his "real" flags before changing them. Let's say that admins had somehow used any combination of the previous operators to remove all flags but 'a' from him, and then give him 's' and 't'.
sm_flags somePlayer = ast
The following command would restore somePlayer's flags to "abcopqr".
sm_flags somePlayer _ @
Similarly, running the following command instead would remove only the 's' flag, and restore somePlayer's access to the 'b' flag.
sm_flags somePlayer _ bs
If, and only if, someAdmin has access to the override sm_sessionflags_reset, he can use the _ operator to reset flags that he himself does not have access to. By default, this feature is basically disabled, as the override defaults to ROOT access.
If this command is used (through ANY operator) to change a player's flags, and his flags end up matching what was saved as his "real" flags, then the plugin will "forget" that his flags were ever changed at all. This will allow other plugins to change flags without too much conflict.
CVARS, shown with default values:
sm_sessionflags_logging 2 - Controls how command usage is logged.
0 : Completely disables logging.
1 : Enables basic logging. If targeting a single player, the logs will show detailed information about what changes were made to that player's flags. If multiple players were targeted, this information is not shown.
2 : Enables verbose logging. The logs will show a seperate line for each player who had their flags changed, with information about what flags were changed.
Updated to 14.0902.0. Changed the default command access flag from 0 to root.
Since players could only grant flags that they themselves have, this was not really a huge issue. The only concerning thing are players who are part of the general public being able to use the reset _ operator to reset the flags of any player they would be able to target.