AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [CS:GO] Hitbox Changer (https://forums.alliedmods.net/showthread.php?t=329554)

PikaJew 12-29-2020 03:25

[CS:GO] Hitbox Changer
 
This is an extension I made to emulate the effects of this thread, because I didn't want to go and recompile all of my models.

Capabilities
This extension provides natives with the ability to modify the hitboxes of a model without recompilation.

You can modify a hitboxes:
  • You can modify a hitboxes:
    • Bone
    • Group
    • Min Point
    • Max Point
    • Angle
    • Radius
    • And you can also get all of this info from a hitbox
  • You can change the number of hitboxes in the hitboxset of the model.
    • You can not change this beyond the amount of hitboxes the model originally had, however you can make it less than or even negative values so you can skip all the calculations for it.
    • Use GetNumHitboxes first if you aren't removing them altogether so you can get the max number you can set without crashing.
  • Print debug info about a models hitboxes to server console
  • Print debug info about a models bones to server console
  • Print a list of valid bones/bone names for use as a hitbox bone
  • Get a bones index by its name
I also made an enum struct in the include if you want to define a bunch of hitboxes to be reused on models easily and cleanly.
A test plugin is in the sourcecode as well if you want to check out how to use the different features.

Natives
  • HitboxInfo: Print all the hitboxes to server console
  • BoneInfo: Print all the bones to server console
  • SetHitbox: Set the properties at a hitbox index
  • GetHitbox: Get the properties at a hitbox index
  • SetNumHitboxes: Set the number of hitboxes for a model
  • GetNumHitboxes: Get the number of hitboxes for a model
  • FindBone: Find a bone's index in a model by name
  • FindValidBones: Print a list of the bones in a model which can have a hitbox attached

Due to the many differences in code between csgo and previous games, this extension was only made for CS:GO, but most of the core code should work if you want to edit it for another game, mostly stuff like removing the capsule hitbox code, feel free to fork it for other games.
This is also the reason for including the modified csgo code, much of it was updated past the point where it would be compatible with the old mirrors, so It took a lot of trial and error to merge old and new together into a functional frankenstein.

For an unknown reason this extension will crash windows servers when they try to get the StudioHDR of a model, and so this extension is linux only unless someone is able to figure out a fix for that, I won't be actively trying to fix it as I don't own any windows servers.
The extension now works for windows thanks to help from Peace-Maker, thanks.

Note: This extension is now included in the latest version of ZR, if you have the latest version, this is already done, just add the extension.
If you are using the ZR plugin, and want to remove human hitboxes for a performance boost, simply alter the zr/models.inc file to include the extension and edit the ModelsPrecache function to be:
Code:

/**
 * Precaches all models.
 */
ModelsPrecache()
{
    decl String:file[PLATFORM_MAX_PATH];

    // Loop through all models, build full path and cache them.
    for (new model = 0; model < ModelCount; model++)
    {
        ModelsGetFullPath(model, file, sizeof(file));
        int modelIndex = PrecacheModel(file);
        if((modelIndex != 0) && (ModelData[model][Model_Team] == ModelTeam_Humans))
            SetNumHitboxes(modelIndex, -1);
    }
}


Get the extension and include on GitHub

Peace-Maker 12-29-2020 22:09

Re: [CS:GO] [Linux] Hitbox Changer
 
IVModelInfo received two more overloads of GetVCollide at the end with some additonal float parameter. The vtable layout on msvc puts all overloads next to each other instead of keeping them at the position in the class like gcc does. So the windows build calls the wrong function 2 below the desired one - GetIlluminationPoint instead of GetStudiomdl.

Adding the new overloads to the end of IVModelInfo in engine/ivmodelinfo.h in the sdk fixes the windows build.
Code:

        virtual vcollide_t                                *GetVCollide(const model_t *model, float unk1) const = 0;
        virtual vcollide_t                                *GetVCollide(int modelindex, float unk1) const = 0;


PikaJew 12-30-2020 05:00

Re: [CS:GO] [Linux] Hitbox Changer
 
Quote:

Originally Posted by Peace-Maker (Post 2730637)
IVModelInfo received two more overloads of GetVCollide at the end with some additonal float parameter. The vtable layout on msvc puts all overloads next to each other instead of keeping them at the position in the class like gcc does. So the windows build calls the wrong function 2 below the desired one - GetIlluminationPoint instead of GetStudiomdl.

Adding the new overloads to the end of IVModelInfo in engine/ivmodelinfo.h in the sdk fixes the windows build.
Code:

        virtual vcollide_t                                *GetVCollide(const model_t *model, float unk1) const = 0;
        virtual vcollide_t                                *GetVCollide(int modelindex, float unk1) const = 0;


Thanks for the feedback, totally new to c++ so I would have never figured this out, updated post and github to reflect this.

Franc1sco 12-31-2020 14:14

Re: [CS:GO] Hitbox Changer
 
I added support for your extension on my zr version here.

FroGeX 12-31-2020 15:51

Re: [CS:GO] Hitbox Changer
 
https://forums.alliedmods.net/showthread.php?t=313027
here is solution without nees use extensions...

zipcore 01-03-2021 15:18

Re: [CS:GO] Hitbox Changer
 
Quote:

Originally Posted by FroGeX (Post 2730833)
https://forums.alliedmods.net/showthread.php?t=313027
here is solution without nees use extensions...


Actually no: The extension allows you to bypass those checks completly instead of checking for each penetration, beside that it gets triggered by player collisions aswell. This method is much more cpu friendly which is a huge deal on zombie escape servers.

vanz 01-06-2021 00:30

Re: [CS:GO] Hitbox Changer
 
Hi guys, I wrote an extension to make teammates completely ignore bullets, thanks to BotoX for his CSSFixes extension https://github.com/vanz666/BulletPenetrationFix

zipcore 01-08-2021 21:07

Re: [CS:GO] Hitbox Changer
 
Quote:

Originally Posted by vanz (Post 2731527)
Hi guys, I wrote an extension to make teammates completely ignore bullets, thanks to BotoX for his CSSFixes extension https://github.com/vanz666/BulletPenetrationFix


Thats better as the plugin only version. But disabling the hitbox completly still saves more performence.

kratoss1812 01-09-2021 12:16

Re: [CS:GO] Hitbox Changer
 
Could someone do a plugin using this that disable nade collision on teammates?
Sometimes, whe I throw grenades, teammates blocks them and it's annoying.

Stewart Anubis 01-11-2021 12:31

Re: [CS:GO] Hitbox Changer
 
Could you put the link with the compiled version for windows?


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

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