Raised This Month: $12 Target: $400
 3% 

[CS:GO] Hitbox Changer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PikaJew
Junior Member
Join Date: Mar 2020
Old 12-29-2020 , 02:25   [CS:GO] Hitbox Changer
Reply With Quote #1

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
__________________
Where am I even going...

Last edited by PikaJew; 01-03-2021 at 05:07. Reason: Implemented into ZR
PikaJew is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 12-29-2020 , 21:09   Re: [CS:GO] [Linux] Hitbox Changer
Reply With Quote #2

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;
__________________
Peace-Maker is offline
PikaJew
Junior Member
Join Date: Mar 2020
Old 12-30-2020 , 04:00   Re: [CS:GO] [Linux] Hitbox Changer
Reply With Quote #3

Quote:
Originally Posted by Peace-Maker View Post
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.
__________________
Where am I even going...
PikaJew is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 12-31-2020 , 13:14   Re: [CS:GO] Hitbox Changer
Reply With Quote #4

I added support for your extension on my zr version here.
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
FroGeX
Senior Member
Join Date: Aug 2020
Old 12-31-2020 , 14:51   Re: [CS:GO] Hitbox Changer
Reply With Quote #5

https://forums.alliedmods.net/showthread.php?t=313027
here is solution without nees use extensions...
FroGeX is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 01-03-2021 , 14:18   Re: [CS:GO] Hitbox Changer
Reply With Quote #6

Quote:
Originally Posted by FroGeX View Post
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.
__________________
zipcore is offline
vanz
Junior Member
Join Date: Apr 2020
Old 01-05-2021 , 23:30   Re: [CS:GO] Hitbox Changer
Reply With Quote #7

Hi guys, I wrote an extension to make teammates completely ignore bullets, thanks to BotoX for his CSSFixes extension https://github.com/vanz666/BulletPenetrationFix
vanz is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 01-08-2021 , 20:07   Re: [CS:GO] Hitbox Changer
Reply With Quote #8

Quote:
Originally Posted by vanz View Post
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.
__________________

Last edited by zipcore; 01-08-2021 at 20:12.
zipcore is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 01-09-2021 , 11:16   Re: [CS:GO] Hitbox Changer
Reply With Quote #9

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.
__________________
kratoss1812 is offline
Stewart Anubis
Junior Member
Join Date: Jul 2020
Old 01-11-2021 , 11:31   Re: [CS:GO] Hitbox Changer
Reply With Quote #10

Could you put the link with the compiled version for windows?
Stewart Anubis is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:41.


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