AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] Input Hooks - DevTools (1.9) [15-Jun-2022] (https://forums.alliedmods.net/showthread.php?t=319141)

Silvers 10-14-2019 13:50

[ANY] Input Hooks - DevTools (1.9) [15-Jun-2022]
 
23 Attachment(s)


Related Plugins:

About:
  • Prints entity input data to chat (client) or console (server).
  • Can specify which entities to listen for or filter out.
  • Example command: sm_input_watch "logic_script,logic_entity,logic_relay"


Supported Games:
  • CSS
  • CSGO
  • DODS
  • L4D1
  • L4D2
  • TF2
  • Request support if required.


Thanks:
  • Dr!fter - DHooks "AcceptInput" example this is based on.
  • Dragokas - For the request and code additions.


Admin Commands: (requires "z" flag)

PHP Code:

sm_input_listen    // Starts listening to all inputs. Filters or listens for classnames from the filter and listen cvars.
sm_input_stop      // Stop printing entity inputs.
sm_input_watch     // Start printing entity inputs. Usage: sm_input_watch <classnames to watch, separate by commas> 



ConVars:

Saved to sm_input_hooks.cfg in your servers \cfg\sourcemod\ folder.

PHP Code:

// Do not hook and show output data from these classnames, separate by commas (no spaces). Only works for sm_output_listen command.
sm_input_hooks_filter ""

// Only hook and display output data from these classnames, separate by commas (no spaces). Only works for sm_output_listen command.
sm_input_hooks_listen ""

// 0=Off. 1=Logs all input data to logs/input_hooks.log file.
sm_input_hooks_logging "0"

// Output Hooks - DevTools plugin version.
sm_input_hooks_version 



Changes:
Code:

1.9 (15-Jun-2022)
    - Changed some white spacing sizes when printing.
    - Removed quotes when printing various information, for a cleaner look.

1.8 (29-Apr-2022)
    - Added support for various types. Thanks to "Ilusion9" for coding.

1.7 (10-Apr-2022)
    - Added support for the "Pirates, Vikings and Knights II" game. GameData updated. Thanks to "Marttt" for the offsets.
    - Fixed crash when retrieving Color255 values. Thanks to "Ilusion9" for reporting and "domino_" for helping fix.

1.6 (20-May-2021)
    - Fixed using a static list for reading values instead of strings. Thanks to "bottiger" for fixing.

1.5 (03-Mar-2021)
    - Fixed crashing on "SetTotalItems" input. Thanks to "Marttt" for reporting.

1.4a (30-Sep-2020)
    - Compatibility update for L4D2's "The Last Stand" update.
    - L4D2: GameData .txt file updated.

1.4 (10-May-2020)
    - Added better error log message when gamedata file is missing.
    - Various changes to tidy up code.

1.3 (16-Mar-2020)
    - Fixed server crashing when reading "InValue" commands.
    - Fixed not logging when server is empty.
    - Fixed logging code in the wrong place.

1.2 (05-Dec-2019)
    - Added cvar "sm_input_hooks_logging" to enable or disable logging.
    - Added entity name to info. - Thanks to "Dragokas" for coding.
    - Added ability to log info in file "logs/input_hooks.log". - Thanks to "Dragokas" for coding.

1.1 (15-Nov-2019)
    - Fixed multiple classnames not working for the watch command and cvars.

1.0 (14-Oct-2019)
    - Initial release.



Requirements:

Installation:
DO NOT click 'Get Plugin' or it will fail to compile because this plugin requires DHooks!
  1. Download the .smx file and put into your servers \addons\sourcemod\plugins folder.
  2. Download the .txt gamedata file and put into your servers \addons\sourcemod\gamedata\ folder.


Updating from 1.1 or older:
  • New cvars have been added: use the Cvar Configs Updater, or delete the old cvars config or manually add them.

Dragokas 10-14-2019 17:03

Re: [ANY] Input Hooks - DevTools
 
Thanks again. This make development a looooooot easier.

andi67 10-14-2019 17:38

Re: [ANY] Input Hooks - DevTools
 
No.1 ....

Alexander_Mirny 10-14-2019 17:43

Re: [ANY] Input Hooks - DevTools
 
not bad :up:

lugui 10-18-2019 07:52

Re: [ANY] Input Hooks - DevTools
 
very nice, it will be helpful

Silvers 11-15-2019 03:51

Re: [ANY] Input Hooks - DevTools (1.1) [15-Nov-2019]
 
Plugin updated.

Quote:

1.2 (05-Dec-2019)
- Added cvar "sm_input_hooks_logging" to enable or disable logging.
- Added entity name to info. - Thanks to "Dragokas" for coding.
- Added ability to log info in file "logs/input_hooks.log". - Thanks to "Dragokas" for coding.

1.1 (15-Nov-2019)
- Fixed multiple classnames not working for the watch command and cvars.

Silvers 03-16-2020 03:13

Re: [ANY] Input Hooks - DevTools (1.3) [16-Mar-2020]
 
Code:

1.3 (16-Mar-2020)
    - Fixed server crashing when reading "InValue" commands.
    - Fixed not logging when server is empty.
    - Fixed logging code in the wrong place.

If there are any other crashes please let me know which map, or better which command (you can find out by putting the following code after the "DHookGetParamString" line and seeing the last result in server console before crash).

Code:

PrintToServer("%s", command);

Ilusion9 08-25-2020 03:24

Re: [ANY] Input Hooks - DevTools (1.4) [10-May-2020]
 
https://crash.limetech.org/gv4g4mf7khdl

linux
sm 1.10
dhooks for 1.10

PHP Code:


I modified this
:
public 
MRESReturn AcceptInput(int entityHandle hReturnHandle hParams)
{
    if (
entity 0)
    {
        
entity EntRefToEntIndex(entity);
    }
    
    
char input[128];
    
DHookGetParamString(hParams1inputsizeof(input));

    
char classname[128];
    
GetEntityClassname(entityclassnamesizeof(classname));
    
    
int activator = -1;
    if (!
DHookIsNullParam(hParams2))
    {
        
activator DHookGetParam(hParams2);
    }
    
    
// Print etc..
    
return MRES_Ignored;



Ilusion9 08-25-2020 03:34

Re: [ANY] Input Hooks - DevTools (1.4) [10-May-2020]
 
He does the same thing here:
PHP Code:

    if( pThis )
        
pThis EntRefToEntIndex(pThis); 

And I've seen entities with negative values or higher than 4096, I thought entities can only have indexes between 0 and 4096..,

Silvers 08-26-2020 19:01

Re: [ANY] Input Hooks - DevTools (1.4) [10-May-2020]
 
Quote:

Originally Posted by Ilusion9 (Post 2715440)

Which game? Which plugin version? You modified that (and removed stuff?) why?

It has a specific check for reading "InValue" commands which would crash when reading with any other method, there maybe other commands which need to be read as objects instead, you can debug where its crashing by printing/logging the "command" variable value and seeing the last one printed before crash, and let me know what it is so I can fix the plugin.



Quote:

Originally Posted by Ilusion9 (Post 2715444)
He does the same thing here:
PHP Code:

    if( pThis )
        
pThis EntRefToEntIndex(pThis); 

And I've seen entities with negative values or higher than 4096, I thought entities can only have indexes between 0 and 4096..,

Because negative entity indexes are more than likely going to be entity references which is used by non-networked entities (their index is > 2048 or > 4096 depending on the game and their max entity limits). See the [TUT] SourcePawn Scripting - Tips, Basics to Advanced for more details.

The plugin should probably be checking EntRefToEntIndex != INVALID_ENT_REFERENCE after converting but I don't see why an input triggered at this stage would ever be an invalid entity (probably the reason I left out the check to see if anyone reports an invalid entity error - I specifically do this for various plugins where I think a check would not have to be required and wait for any error reports, rarely some trigger errors and sometimes only very rarely).


All times are GMT -4. The time now is 19:57.

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