Block Hidden Commands from Help Command#1831
Block Hidden Commands from Help Command#1831peace-maker merged 1 commit intoalliedmodders:masterfrom Batfoxkid:patch-1
Conversation
Allows using `FCVAR_HIDDEN` to block commands from appearing in `sm_help` and `sm_searchcmd` which helps with creating alias to commands without filling up the list with those aliases.
For example:
```sourcepawn
RegAdminCmd("sm_setmyperk", MyCommand, ADMFLAG_CHEATS);
RegAdminCmd("sm_setmyperks", MyCommand, ADMFLAG_CHEATS, _, FCVAR_HIDDEN);
RegConsoleCmd("ff2_boss", MyCommand);
RegConsoleCmd("ff2boss", MyCommand, _, FCVAR_HIDDEN);
```
| cmdIter.GetDescription(desc, sizeof(desc)); | ||
|
|
||
| if ((StrContains(name, arg, false) != -1) && CheckCommandAccess(client, name, cmdIter.Flags)) | ||
| if ((StrContains(name, arg, false) != -1) && ((FindConVar(name).Flags & FCVAR_HIDDEN) == 0) && CheckCommandAccess(client, name, cmdIter.Flags)) |
There was a problem hiding this comment.
Doesn't cmdIter.Flags already give you the flags, why the additional lookup?
There was a problem hiding this comment.
Doesn't
cmdIter.Flagsalready give you the flags, why the additional lookup?
That is for admin flags and not command flags.
There was a problem hiding this comment.
Seems like it would be a good idea to add it to the iterator before making this change - we don't need workarounds here.
There was a problem hiding this comment.
I'd rather add the convar flags property in a seperate PR and switch this over? It doesn't really fit the goal of this one.
peace-maker
left a comment
There was a problem hiding this comment.
This seems like a nice non-intrusive addition to the help menu. All commands should be visible by default and allowing you to hide aliases this way does help the readability of the help menu.
Allows using
FCVAR_HIDDENto block commands from appearing insm_helpandsm_searchcmdwhich helps with creating alias to commands without filling up the list with those aliases.For example: