You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you try to use Sandbox.Hitbox.GetName(), you will never grab the name of the hitbox hit by a Trace.
You always get <invalid> instead
Is problematic if you want to do some debugging of the hitbox for your player model
To Reproduce
Download sandbox game (to be sure you playing with Terry models/citizen/citizen.vmdl)
Edit the Player.csTakeDamage function :
Add something like this :
public override void TakeDamage( DamageInfo info )
{
Log.Info( info.Hitbox.GetName() );
if ( info.Hitbox.HasTag("head")) // Just be sure your trace uses UseHitboxes()
{
Log.Info( "Headshot" );
}
// [...] trunc
base.TakeDamage( info );
}
Start a sandbox game, spawn a bot, and shoot him: you will get an <invalid> for info.Hitbox.GetName() but you will get "Headshot" printed if you shoot in the head.
PS : I also tried to add these lines in the Respawn() function but the error is still present
The documentation says "Grab the name of the hitbox, please note that internally we store this as a string token, so using this frequently is ill advised." but invalid is not the correct name of the hitbox 🤓
Media/Files
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
Hi,
If you try to use Sandbox.Hitbox.GetName(), you will never grab the name of the hitbox hit by a Trace.
You always get
<invalid>
insteadIs problematic if you want to do some debugging of the hitbox for your player model
To Reproduce
Player.cs
TakeDamage
function :Add something like this :
<invalid>
forinfo.Hitbox.GetName()
but you will get "Headshot" printed if you shoot in the head.PS : I also tried to add these lines in the Respawn() function but the error is still present
Expected behavior
The documentation says "Grab the name of the hitbox, please note that internally we store this as a string token, so using this frequently is ill advised." but invalid is not the correct name of the hitbox 🤓
Media/Files
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: