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)

Ilusion9 08-27-2020 03:59

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

Originally Posted by Silvers (Post 2715644)
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.

CSGO, I put back that thing with "InValue" etc, but it seems the crash happens when I kill entities on SDKHook_Spawn with AcceptEntitiyInput(entitiy, "Kill");
I dhook AcceptInput on SDKHook_SpawnPost and no crashes.

Marttt 02-28-2021 14:58

Re: [ANY] Input Hooks - DevTools (1.4a) [10-May-2020]
 
I have found a plugin conflict with [L4D2] Gas Cans by disawar1.

After many tests, I noticed that on c1m4_atrium map, when I enable the listen mode (sm_input_listen), right after pressing the elevator button the server crashes.

Here is the crash log.

I extracted the part from disawar1 code that triggers the crash and made a short plugin to test it.

To reproduce: Go to c1m4_atrium map, use !input_listen and then !testcrash.

Just reporting in case someone has the same problem.

Code snippet for testing below:

Spoiler


EDIT: Fixed by Silvers in newer versions.

Silvers 03-03-2021 04:11

Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
 
Thanks, fixed. Example crash plugin was very helpful to test.

bottiger 05-11-2021 18:56

Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
 
Quote:

Originally Posted by Silvers (Post 2739053)
Thanks, fixed. Example crash plugin was very helpful to test.

Why not read fieldType to determine the type of the union?

https://github.com/ValveSoftware/sou...ariant_t.h#L37

Silvers 05-12-2021 03:52

Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
 
Quote:

Originally Posted by bottiger (Post 2746576)
Why not read fieldType to determine the type of the union?

https://github.com/ValveSoftware/sou...ariant_t.h#L37

How?

bottiger 05-13-2021 19:18

Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
 
Quote:

Originally Posted by Silvers (Post 2746602)
How?

The offset of fieldType is the largest size of the union + sizeof(eVal).

Silvers 05-14-2021 22:19

Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
 
Quote:

Originally Posted by bottiger (Post 2746753)
The offset of fieldType is the largest size of the union + sizeof(eVal).

How can it be done in this plugin? How do I determine if I should be reading an int or string etc? When calling DHookGetParamObjectPtrVar for an int the server will crash if it's supposed to be a string.

bottiger 05-15-2021 15:00

Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
 
Quote:

Originally Posted by Silvers (Post 2746850)
How can it be done in this plugin? How do I determine if I should be reading an int or string etc? When calling DHookGetParamObjectPtrVar for an int the server will crash if it's supposed to be a string.

Hi sorry I am not well versed in dhooks, I just tried using it last week.

But you could try this: I don't know if the offset should be divided by sizeof(int).

int fieldtype = DHookGetParamObjectPtrVar(hParams, 4, offset_of_fieldType, ObjectValueType_Int),

then check if fieldtype == FIELD_STRING or FIELD_INTEGER or some other type here:

https://github.com/ValveSoftware/sou.../datamap.h#L28

Silvers 05-15-2021 18:20

Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
 
I don't think that's the same offset as NetProps and DataMaps which would be possible to get the param type.

bottiger 05-15-2021 23:28

Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
 
Quote:

Originally Posted by Silvers (Post 2746904)
I don't think that's the same offset as NetProps and DataMaps which would be possible to get the param type.

Not sure what you mean by being the same offset as netprops or datamaps.

The acceptinput function you are hooking has a variant_t struct.

AcceptInput( const char *szInputName, CBaseEntity *pActivator, CBaseEntity *pCaller, variant_t Value, int outputID );

You have the definition of this struct right here:

PHP Code:

class variant_t
{
    
union
    
{
        
bool bVal;
        
string_t iszVal;
        
int iVal;
        
float flVal;
        
float vecVal[3];
        
color32 rgbaVal;
    };
    
CHandle<CBaseEntity> eVal; // this can't be in the union because it has a constructor.

    
fieldtype_t fieldType

All you have to do is access the fieldType member which has nothing to do with datamaps or netprops. It is just a tagged union.

Anyway I didn't want to spent any more time on this, but I was confused by what you meant and thought it couldn't be that hard so I decided to try it myself and it works.

PHP Code:

public MRESReturn AcceptInput(int pThisHandle hReturnHandle hParams)
{
    
// Get args
    
static char param[128];
    static 
char command[128];
    
DHookGetParamString(hParams1commandsizeof(command));

    
int paramType DHookGetParamObjectPtrVar(hParams416ObjectValueType_Int);
    
PrintToServer("param type %i"paramType); 

param type 0
2091 math_counter. (GetValue). "counter" (). 1 player caller 50
param type 1
2079 info_target. (InValue). "case" (). 1 player caller 50


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

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