• Modify to only display when being looked at, and at certain distance?
    2 replies, posted
How could I modify the following, so the ring is only shown below the player if player is <500 units away, and in the other player's crosshair? [lua] local CircleMat = Material( "SGM/playercircle" ) hook.Add( "PrePlayerDraw", "PlayerRings", function( ply ) ------------------------------------ local radius = 35 ------------------------------------ local trace = {} trace.start = ply:GetPos() + Vector(0,0,50) trace.endpos = trace.start + Vector(0,0,-300) trace.filter = ply local tr = util.TraceLine( trace ) local color = table.Copy( team.GetColor( ply:Team() ) ) color.a = 170 if !tr.HitWorld then tr.HitPos = ply:GetPos() end render.SetMaterial( CircleMat ) render.DrawQuadEasy( tr.HitPos + tr.HitNormal, tr.HitNormal, radius, radius, color ) end ) [/lua]
[b][url=http://wiki.garrysmod.com/?title=Vector.Distance]Vector.Distance [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] [b][url=http://wiki.garrysmod.com/?title=Player.GetEyeTrace]Player.GetEyeTrace [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] Thats all you need, and a brain.
Thank you. Exactly what I was looking for.
Sorry, you need to Log In to post a reply to this thread.