this have it set up now, I don't see what the problem is, it all looks fine.
function GetTraceProp() -- This is a clientside function, please do not run it serverside.
local trace = util.TraceLine( util.GetPlayerTrace( LocalPlayer() ) )
for k,v in pairs( GetTraceProp() ) do
if v == trace.Entity then
return v
end
end
end
-- What Kind Of Glow?
hook.Add( "PreDrawHalos", "AddHalos", function()
halo.Add( GetTraceProp(), Color( 140, 0, 255 ), 5, 5, 2 )
end )
are you asking me to flip the two?
You weren't supposed to replace "ents.FindByClass( "prop_physics" )" in Neku's code with GetTraceProp(), you were supposed to replace it in your halo.Add code. Right now, the function is trying to loop through itself in the for loop, causing the stack overflow.
I think I've got it... my partner and I took a second look at it. this is what we came up with
you had
local trace = util.TraceLine( util.GetPlayerTrace( LocalPlayer() ) )
we have
local trace = util.TraceLine( util.GetPlayerTrace( ply, dir ) )
see the difference? im running it now I will let you know my results.
This wouldn't even work due to "ply" not being specified, which is what "LocalPlayer()" is supposed to be.
The problem here wasn't Neku's original code, it was just a misunderstanding on your part (it can happen to everyone, I'm not trying to say anything bad about you).
Replace line 3 in this code (taken from one of Wolf's replies):
function GetTraceProp() -- This is a clientside function, please do not run it serverside.
local trace = util.TraceLine( util.GetPlayerTrace( LocalPlayer() ) )
for k,v in pairs( GetTraceProp() ) do
if v == trace.Entity then
return v
end
end
end
-- What Kind Of Glow?
hook.Add( "PreDrawHalos", "AddHalos", function()
halo.Add( GetTraceProp(), Color( 140, 0, 255 ), 5, 5, 2 )
end )
With this:
for k,v in pairs( ents.FindByClass( "prop_physics" ) ) do
So the finished code looks like this:
function GetTraceProp() -- This is a clientside function, please do not run it serverside.
local trace = util.TraceLine( util.GetPlayerTrace( LocalPlayer() ) )
for k,v in pairs( ents.FindByClass( "prop_physics" ) ) do
if v == trace.Entity then
return v
end
end
end
-- What Kind Of Glow?
hook.Add( "PreDrawHalos", "AddHalos", function()
halo.Add( GetTraceProp(), Color( 140, 0, 255 ), 5, 5, 2 )
end )
Which is what Neku originally meant by
Replace ents.FindByClass( "prop_physics*" ) with GetTraceProp()