AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] !COMMAND eater (https://forums.alliedmods.net/showthread.php?t=319752)

Dragokas 11-17-2019 19:22

[ANY] !COMMAND eater
 
1 Attachment(s)
Description:
Allows to accept commands entered in chat in uppercase, without key trigger or in cyrillic (by accident).

Supported both, chat and console commands.

Examples:
Quote:

!ADMIN
/ADmin
!ФВЬШТ
/фвьшт
sm_ADMIn
!SM_Admin
.ADMIN
ADMIN
админ
Also, plugin allows you to log unknown commands. Location: logs/cmd_unknown.log

Note: Since SourceMod v1.11.0.6725 this plugin is not much useful for English only servers, because it is already include case insensitive fix for chat commands (Pull #1542).

Notice for ALL:
"Eat" != does not mean "Hide". If you need to hide your entered command, set sm_eater_nokey_silent ConVar to 1 - this only applied to command entered without ! or / prefix.

If you want to hide really ALL commands (even those entered with ! prefix), set up your addons/sourcemod/configs/core.cfg file such a way:
PHP Code:

"PublicChatTrigger"        ""
"SilentChatTrigger"        "/!" 

then set sm_eater_nokey_silent ConVar to 1 and reboot the server.
Settings (ConVars):
Located at: cfg/sourcemod/sm_command_eater.cfg:
PHP Code:

// Enable plugin? (1 - Yes / 0 - No)
sm_eater_enable "1"

// Do you want to log not recognized commands? (1 - Yes / 0 - No)
sm_eater_unknown_logging "1"

// Do you want ability to enter commands without prepending key trigger? (1 - Yes / 0 - No)
sm_eater_nokey_allow "1"

// Commands entered without key trigger should be silent? (1 - Yes / 0 - No)
sm_eater_nokey_silent "0"

// Minimum allowed length of command entered without key trigger
sm_eater_nokey_minlength "2" 

// Enable 'eating' commands entered in console? (1 - Yes / 0 - No)
sm_eater_eat_console "1"

// Do we need handle cyrillic letters? (1 - Yes / 0 - No)
sm_eater_eat_cyrillic "1"

// Allow to substitute English analogues for Russian letters, e.g. админ -> admin (1 - Yes / 0 - No)
sm_eater_transliteration "1"

// Ignore chat processor and intercept 'say' command instead? (1 - Yes / 0 - No)
sm_eater_ignore_chat_proc "0"

// Check commands of dynamically loaded plugins. Causes less gaps, but more CPU loading! (1 - Yes / 0 - No)
sm_eater_track_dyn_load "1" 

in source code (.sp):
PHP Code:

// set to 1 and recompile plugin if you faced with some problems and you need to provide logs for developer (will be saved to "logs/cmd_eater_debug.log")
#define DEBUG 0

// set to 0 if want to try compile with CCP support (ccprocessor.inc); only old versions of CCP will compile.
#define _ccprocessor_disable 1" to 0. 

Commands:
PHP Code:

// Refresh the list of commands. It is recommended to use it in Map Config plugins which dynamically load/unload other plugins
sm_eater_refresh 

* For a more elegant and automatic implementation, I am awaiting a solution / implementation from SourceMod team of at least one of these Issues: #1480, #1481, (#890 + #1482)
Credits:
- SilverShot - for "Commands enumerator" code and SMC Parser and profiler examples.
- hmmmmm - for solution to my new debug code style.
- Ilusion9 - for suggestion the correct replicating of GetCmdReplySource.
- Bacardi - for suggesting me ReadCommandIterator() to differentiate sm commands.
- Balimbanana - for suggesting me OnClientCommand() to catch unrecognized console commands.
Supported:
- Chat processor by Drixevel: https://github.com/Drixevel/Chat-Processor
- Simple Chat Processor (Redux) by Mini (minimoney1): https://forums.alliedmods.net/showthread.php?t=198501
- (support suspended) Color Chat Processor by nullent?: https://github.com/rej-clown/ccprocessor
- or without chat processor at all (color tags will not be processed in that case).
Compatiblity:
- Minimum supported SM v.1.9
- Recommended SM v.1.11.0.6541+ (crash free)
Notes:
1. If you receive false positives, you have such options:
- increase minimal length of handled commands entered without key trigger !/ see "sm_eater_nokey_minlength" ConVar
- disable handling commands entered without key trigger !/ see "sm_eater_nokey_allow" ConVar
- add concrete command to exclude list - add it in file - data/sm_eater_exclude.txt (each command on separate line),
e.g. sm_lf will prevent replacing "да" with sm_lf (if it would exist on your server).
- disable handling cyrillic transliteration at all (in case you have no users with Russian keyboard on your server), see "sm_eater_eat_cyrillic" ConVar.

2. If you receive chat commands flood in console, you have such options:
- update your Chat Processor to the latest version
- disable interaction with Chat Processor by set "sm_eater_ignore_chat_proc" ConVar to 1.
Related plugins:
- [ANY] [RU] Message Filter (Censor)
Donate
Donates are very appreciated and welcomed for further inspiration, make me happy, and make next updates came out more often:
- Patreon (Paypal)
- BitCoin
- Ю.Money

Dragokas 12-19-2019 21:04

Re: [ANY] !COMMAND eater
 
Updated.

Quote:

1.1 (20-Nov-2019)
- Added ability to log unknown commands to logs/cmd_unknown.log (identical commands will not be repeated in log)

1.2 (20-Dec-2019)
- Fixed bug: color tag is not parsed
- Added ability to remove <chat-processor> dependency with reduced functionality (by SilverShot request).
To make so, change #define USE_CHAT_PROCESSOR to 0 and recompile the plugin.

Dragokas 12-28-2019 18:34

Re: [ANY] !COMMAND eater
 
Updated.

Quote:

1.4 (28-Dec-2019)
- (dot) .command is now alias to /command, so you can write commands beginning with . (dot)
- Added "sm_eater_nokey_allow" ConVar - ability to enter commands without prepending key trigger at all, e.g. ADMIN, not !ADMIN (1 - Enable, 0 - Disable, for better performance).
- Added "sm_eater_nokey_silent" ConVar - Commands entered without key trigger should be silent? (1 - Yes / 0 - No).
- "sm_unknown_logging" ConVar is renamed to "sm_eater_unknown_logging" to follow naming convention better.
- Added "Simple Chat Processor (Redux)" support. No need to re-compile the plugin. Processor is detected automatically.
Note: remove chat-processor.smx from server if you don't use it anymore.
- Chat processors are stored now in separate "Chat_Processors" folder (use it just in emergency case, e.g. when source code is lost or new version break compatibility...).
- Fixed color tag bug caused by dependency on plugins load order.
- potential fix: multiple starting color tags are supported now.
- unknown command is logged now without normalization, exactly same as it was written by user.
- in case some problems still persist, you can enable extended debug by #define DEBUG 1 (will be written in "logs/cmd_eater_debug.log")

Dragokas 02-15-2020 04:59

Re: [ANY] !COMMAND eater
 
Updated.

Quote:

1.6 (12-Feb-2020)

Features:
- Added support for !sm_ /sm_ sm_ prefixes entered in chat, including misprinted (wrong letter case and cyrillic).
- Added "sm_eater_enable" ConVar - to disable plugin in runtime (just in case).
- Added "sm_eater_eat_cyrillic" ConVar instead of "#define EAT_CYRILLIC".
- Added "sm_eater_nokey_minlength" ConVar to decrease false positives.
You can define here minimal length of command (entered without key trigger "!","/") allowed to be handled by "eater". By default: 2.

- added commands exclusion file: "addons/sourcemod/data/sm_eater_exclude.txt":
enter each command on the new line you may want to exclude from handling by this plugin to prevent false positives.

- now, unknown commands are not checked for duplicates anymore (useless thing). Instead, player name, steamid, country, ip are prepended in log.
- "eater" is now handling ALL in-game commands, registered with sm_ and without. However, YOU can "misprint" them using any variant.

Other:
- New dependency: <geoip>
- RegConsoleCmd() replaced by AddCommandListener() to handle it in correct way and order.
- Fixed missing CloseHandle of commands enumerator (not critical).
- Fixed missing ConVar version notify flag.
- fixed cmd-arg parser is not worked properly with multiple tags of color specified.
- Added additional check preventing "say" / "say_team" commands to be registered twice.
- Some simplifications and optimizations:
* thanks to hmmmmm for helping with my new debug code style.
* thanks to SilverShot for profiler sample.

1.7 (15-Feb-2020)
- FakeClientCommand() is replaced by -Ex variant to prevent beeing networked and fix further issues with some recurse reported.

Psyk0tik 02-15-2020 05:13

Re: [ANY] !COMMAND eater
 
PHP Code:

if ( !(sLine[0] == 's' && sLine[1] == 'm' && sLine[2] == '_') ) // Line 284 

Why not just use strncmp to check if the first 3 characters contain "sm_"?

PHP Code:

if ( strncmpsLine"sm_"3false ) != // This also allows you to ignore case sensitivity. 

Same with:

PHP Code:

if ( !(name[0] == 's' && name[1] == 'm' && name[2] == '_') ) // Line 313 


Dragokas 02-15-2020 05:20

Re: [ANY] !COMMAND eater
 
Yea, make sense. Thanks.

Dragokas 02-16-2020 03:42

Re: [ANY] !COMMAND eater
 
Updated.

Quote:

1.8 (16-Feb-2020)
- Some optimizations (thanks to Crasher for remark).
- Replicate GetCmdReplySource() to allow plugins understand that command came from chat (thanks to Ilusion9 for solution).
- appended some debugging code.
- fixed some mistakes with "." prefix trigger.
P.S. If you need to add other languages mistakes support, tell me.

Dragokas 02-17-2020 03:04

Re: [ANY] !COMMAND eater
 
Updated.

Quote:

1.9 (17-Feb-2020)
- prevented very strange bug with chat procesor when he duplicates forward calling multiple times (skip flood coming < 300 ms.).
- Added "sm_eater_ignore_chat_proc" ConVar - set 1 if you want ignore handling messages coming from chat processor and use 'say' hook instead (just in case some problems still persists).

Dragokas 02-18-2020 07:57

Re: [ANY] !COMMAND eater
 
Updated.
Quote:

1.11 (18-Feb-2020)
- Added support for multiple (or empty) defined chat triggers in core.cfg.
- Fixed "sm_eater_nokey_minlength" ConVar incorrectly handled when calculated multi-byte characters.

Dragokas 04-26-2020 13:01

Re: [ANY] !COMMAND eater
 
Updated.

Quote:

1.12 (20-Apr-2020)
- Added a little delay before loading list of commands to support one loaded with a frame delay or so.
- Added reloading command list on map start to support commands registered with late loaded plugins.

1.13 (26-Apr-2020)
- Fixed false positives for default game commands, like "bind" when they are entered in chat (thanks for help to Bacardi).
- Added ability to "eat" console commands (thanks for help to Balimbanana):
* New ConVar added "sm_eater_eat_console" - default: 1 - to enable "eating" commands entered in console.
- Added ability of reverse Russian transliteration (like replacing "шоп" => "shop", "админ" => "admin" ):
* New ConVar added "sm_eater_transliteration" - default: 1 - allow to substitute English analogues for Russian letters.
Also, if you are using Chat processor by Keith Warren (Shaders Allen),
I'd suggest to update it to a version from my fork, not yet included in basic branch: https://github.com/dragokas/Chat-Processor
to fix message color problem.

axelnieves2012 04-26-2020 14:46

Re: [ANY] !COMMAND eater
 
nice idea, thanks

Dragokas 02-22-2021 23:06

Re: [ANY] !COMMAND eater
 
Updated.

Quote:

1.14 (13-Sep-2020)
- Added support for dynamically loaded plugin commands:
* New ConVar added "sm_eater_track_dyn_load" - default: 1 - Check commands of dynamically loaded plugins. Causes less gaps, but more CPU loading! (1 - Yes / 0 - No).

1.15 (19-Sep-2020)
- Improved support for dynamically loaded commands.
- Imporved "DeTranslit".
- Improved optimization (preventing twice command check logic).

1.16 (23-Feb-2021)
- Added a walkaround for parser bug to compile successfully on SM 1.11.

Dragokas 04-20-2021 11:29

Re: [ANY] !COMMAND eater
 
Updated.

Quote:

1.17 (20-Apr-2021)
- Added support for new: Color Chat Processor by nullent?: https://github.com/nyood/ccprocessor (thanks to @Round for testing):
> Note 1: You must have ccprocessor.inc in your /includes/ folder in order to compile "Command Eater" correctly with CCP support.
> Note 2: Due to current bug, do not use tv_enable 1 in your server.
- Prevented client-side console commands from triggering anti-spam function, such a way making "Command Eater" temporarily unavailable sometimes:
> all unrecognized console commands will be automatically added to a separate exclusion list and will no longer be handled from console.
- "Vote Yes" and "Vote No" are added to console exclusion list: it is default binds, which are conflict with sm_vote command.
- Prevented case when "Dynamically" loaded commands detection feature breaks lower-case compare function.
- Added new command "sm_eater_refresh" - Refresh the list of commands. It is recommended to use it in Map Config plugins which dynamically load/unload other plugins:
> For a more elegant and automatic implementation, I am awaiting a solution / implementation from SourceMod team of at least one of these Issues:
> https://github.com/alliedmodders/sourcemod/issues/1480
> https://github.com/alliedmodders/sourcemod/issues/1481
> https://github.com/alliedmodders/sourcemod/issues/890 + https://github.com/alliedmodders/sourcemod/issues/1482
- Other optimizations.
Added "Notice for ALL" in 1st post.

Voevoda 11-11-2021 19:13

Re: [ANY] !COMMAND eater
 
thanks very good plugin

ur5efj 07-05-2022 11:02

Re: [ANY] !COMMAND eater
 
SOURCEMOD_VERSION "1.11.0.6905"
Code:

L 07/05/2022 - 17:57:05: SourceMod error session started
L 07/05/2022 - 17:57:05: Info (map "c1m1_hotel") (file "C:\SteamCMD\SteamApps\common\Left 4 Dead 2 Dedicated Server\left4dead2\addons\sourcemod\logs\errors_20220705.log")
L 07/05/2022 - 17:57:05: [SM] Exception reported: Not enough space on the heap
L 07/05/2022 - 17:57:05: [SM] Blaming: sm_command_eater.smx
L 07/05/2022 - 17:57:05: [SM] Call stack trace:
L 07/05/2022 - 17:57:05: [SM]  [1] Line 348, sm_command_eater.sp::FillCmds
L 07/05/2022 - 17:57:05: [SM]  [2] Line 198, sm_command_eater.sp::OnMapStart
L 07/05/2022 - 17:57:11: [SM] Exception reported: Not enough space on the heap
L 07/05/2022 - 17:57:11: [SM] Blaming: sm_command_eater.smx
L 07/05/2022 - 17:57:11: [SM] Call stack trace:
L 07/05/2022 - 17:57:11: [SM]  [1] Line 348, sm_command_eater.sp::FillCmds
L 07/05/2022 - 17:57:11: [SM]  [2] Line 191, sm_command_eater.sp::Timer_LoadDelayed
L 07/05/2022 - 17:57:23: Error log file session closed.


Dragokas 07-09-2022 14:15

Re: [ANY] !COMMAND eater
 
Updated.

Quote:

1.18 (09-Jul-2022)
- Disabled support of Color Chat Processor by nullent? (nyood) until the compilation issue will be resolved on its side (Issue #1). If you still want to compile using old CCP, change "#define _ccprocessor_disable 1" to 0.
- Introduced Commands Lazy loading (in case commands list update will be triggered multiple times, all calls converted to a single within 3 seconds).
- Support for new forward "OnNotifyPluginUnloaded" in SM 1.11.
- Fixed warnings on SM 1.11.
- Fixed error "Not enough space on the heap" on SM 1.11.
- Fixed "Array index out of bounds" (last character of "sizeof(string)-1" is null, which is not considered everywhere).
- Appended default exclusion list.
- Fixed command is not "eaten" when it is match with embedded game command as if we would cut "sm_".
- Added listen servers support for entered console commands (not tested).
- NOTE: this plugin is not much useful for English only servers anymore since the SM v1.11.0.6725+ release, because it is already include case insensitive fix for chat commands (Pull #1542).


All times are GMT -4. The time now is 22:20.

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