Ground We Walk Upon, Coloured Cicles

How can i have a coloured cicrcle underneath a player, well actually i need it to be underneath an npc…?

A good example of this is Fretta.

[lua]function GM:DrawPlayerRing( pPlayer )

if ( !IsValid( pPlayer ) ) then return end
if ( !pPlayer:GetNWBool( "DrawRing", false ) ) then return end
if ( !pPlayer:Alive() ) then return end

local trace = {}
trace.start 	= pPlayer:GetPos() + Vector(0,0,50)
trace.endpos 	= trace.start + Vector(0,0,-300)
trace.filter 	= pPlayer

local tr = util.TraceLine( trace )

if not tr.HitWorld then
	tr.HitPos = pPlayer:GetPos()
end

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

render.SetMaterial( CircleMat )
render.DrawQuadEasy( tr.HitPos + tr.HitNormal, tr.HitNormal, GAMEMODE.PlayerRingSize, GAMEMODE.PlayerRingSize, color )	

end

hook.Add( “PrePlayerDraw”, “DrawPlayerRing”, function( ply ) GAMEMODE:DrawPlayerRing( ply ) end ) [/lua]

The idea is you use render.DrawQuadEasy.

This function is called in PrePlayerDraw - This is important.

What should i replace GAMEMODE:DrawPlayerRing( ply ) with?
If it needs replacing… (is it a custom fretta function?)

and also pPlayer?

EDIT: will this also work with npcs? instead of players…? thanks :slight_smile:

EDIT:

this is the kind of thing that i mean…

function DrawRing( ply )
for k, v in pairs( ents.FindByClass( “npc_*” ) ) do
if( v:GetNWBool( “selected” ) ) then

local trace = {}
trace.start 	= v:GetPos() + Vector(0,0,50)
trace.endpos 	= trace.start + Vector(0,0,-300)
trace.filter 	= v

local tr = util.TraceLine( trace )

if not tr.HitWorld then
	tr.HitPos = v:GetPos()
end

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

render.SetMaterial( CircleMat )
render.DrawQuadEasy( tr.HitPos + tr.HitNormal, tr.HitNormal, GAMEMODE.PlayerRingSize, GAMEMODE.PlayerRingSize, color )
      end
 end

end
hook.Add( “PrePlayerDraw”, “DrawPlayerRing”, GAMEMODE:DrawPlayerRing( v ) end )

When you post code like that put it in between [noparse][lua] [/lua][/noparse] tags.