Using use on a prop_physics or prop_ragdoll

How can I get the use function to work on a prop_physics or prop_ragdoll?

Of course I know about the hook… But it doesn’t get called when you use use on a ragdoll.

Then use this:

[lua]hook.Add( “KeyPress”, “RagdollUse”, function( ply, key )
local tr = ply:GetEyeTrace( )
if ( key == IN_USE and ValidEntity( tr.Entity ) and tr.Entity:GetClass( ) == “prop_ragdoll” ) then
– Do stuff
end
end )[/lua]

[lua]hook.Add( “KeyPress”, “RagdollUse”, function( ply, key )
local tr = ply:GetEyeTrace( )
if ( key == IN_USE and ValidEntity( tr.Entity ) and tr.Entity:GetClass( ) == “prop_ragdoll” and tr.HitPos:Distance(ply:EyePos()) < 90) then
– Do stuff
end
end )[/lua]
Don’t want them using things across the map .-.

Oh, I thought GetEyeTrace( ) had a distance of 128 or something by default.

Alright thanks.

It’s like 242424*24 or something. Don’t remember the exact number.

It’s 16384. I’ve tested it.