DrawPlayerRing in Sandbox ?

Hello!
I am a new lua coder , and i dont know, how to do, the teamcolored ring under the players in my gamemode (it’s based on Sandbox). Anybody can help ?
Thank you!

I thought that was only in Fretta.
Although you can make a custom one to work in sandbox.

yes i tried but it had a lot of bug :frowning:

I was working on this a few days ago, let me grab the file.

I’ve already deleted it :frowning: Sorry
But i just cant wait for your version :slight_smile:

[lua]
function DrawPlayerRing( ply )
if ( !IsValid( ply ) ) then return end
if ( !ply:Alive() ) then return end

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 )
   
if not tr.HitWorld then
    tr.HitPos = ply:GetPos()
end

local color = table.Copy( team.GetColor( ply:Team() ) )
color.a = 40;

render.SetMaterial( Material( "SGM/playercircle" ) )
render.DrawQuadEasy( tr.HitPos + tr.HitNormal, tr.HitNormal, 48, 48, color ) 

end
hook.Add( “PrePlayerDraw”, “DrawPlayerRing”, DrawPlayerRing )
[/lua]

funny. I had the same :smiley:

[lua]
local CircleMat = Material( “SGM/playercircle” )

hook.Add( “PrePlayerDraw”, “PlayerRings”, function( ply )
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 )

if !tr.HitWorld then
	tr.HitPos = ply:GetPos()
end

local color = table.Copy( team.GetColor( ply:Team() ) )
color.a = 40;
render.SetMaterial( CircleMat )
render.DrawQuadEasy( tr.HitPos + tr.HitNormal, tr.HitNormal, 48, 48, color )

end )
[/lua]

[editline]07:35PM[/editline]

:ninja:

Wow thank you very much ! :slight_smile:

You can come and see what it’s like at Seth’s Diamond Build 91.192.210.6:27016

Ok Tomorrow i try it :slight_smile: Thanks