• Using use on a prop_physics or prop_ragdoll
    8 replies, posted
How can I get the use function to work on a prop_physics or prop_ragdoll?
[url]http://wiki.garrysmod.com/?title=Gamemode.PlayerUse[/url]
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.
[QUOTE=Overv;17338272]Oh, I thought GetEyeTrace( ) had a distance of 128 or something by default.[/QUOTE] It's like 24*24*24*24 or something. Don't remember the exact number.
[QUOTE=Gbps;17343725]It's like 24*24*24*24 or something. Don't remember the exact number.[/QUOTE] It's 16384. I've tested it.
Sorry, you need to Log In to post a reply to this thread.