• [Snippet]Drawing Players Eye Traces
    4 replies, posted
Just got a little snippet of code here from this massive script i have been building which is a utility clientside script and it's mostly just wallhacks and shits, but it originated from a small radar that Sir Waddlesworth started me off on. My only problem with this snippet is that there is a bit of glitchyness with the beams, if you want, post a fix or edit of this in hope that i can get this right ^.^ Eventually im going to release the massive compilation but not quite yet. I actually wanted to make this, because i was watching FTPJE's stuff on youtube and i saw he had this little beam that showed where people was looking a while back and i was like ":O OMG HOW HE DO DAT!!!" WARNING: IF YOU ARE GOING TO EDIT THIS MAKE SURE YOU ARE STARTING AND ENDING THE 3D CAM APPROPRIATELY AND NOT PREMATURELY OR YOUR GAME WILL CRASH ON SERVER JOIN!!! [code] CreateClientConVar("Radar_Wallhack_DrawEyeTraces",0) // Creates console var function DrawEyeTrace() // Sets the function. for _,a in pairs(player.GetAll()) do // Creates a loop of all players. if GetConVarNumber("Radar_Wallhack_DrawEyeTraces")>=1 and a:GetShootPos():Distance(LocalPlayer():GetShootPos())<3000 and a:GetShootPos():ToScreen().visible and a!=LocalPlayer() then // If they are close or can be seen cam.Start3D(EyePos(),EyeAngles()) // Then start a 3d render where we will draw our beams. render.SetMaterial( Material("models/debug/debugwhite") ) render.DrawBeam( a:GetShootPos(), a:GetEyeTrace().HitPos, 2, 0, 0, Color(255,255,255,255) ) // Draws our beam at the persons eye position. cam.End3D() // Ends the 3d render. end end end hook.Add("HUDPaint","DrawPlayerEyeTraces",DrawEyeTrace) // Hooks it in. [/code]
So this just draws a beam from the shootpos to the eyetrace hitpos of all players? Besides you could just use a different hook so no cam would be required. Besides your code is horrible inefficient.
Post it on the wiki and tidy up your indenting before doing so.
I think the indenting is fine. [editline]10:55AM[/editline] whoops, just realized the inconsistency of the indentation.
Sorry, you need to Log In to post a reply to this thread.