I made this script really quick and the problem is that i can see players through the wall and because im not using 3d2d camera stuff i dont know how to make it work correctly
this is what i have soo far (everything is clientside)
// Clientside Convars
CreateClientConVar( "nametags_enable", 1, true, false )
CreateClientConVar( "nametags_drawname", 1, true, false )
CreateClientConVar( "nametags_drawrank", 1, true, false )
CreateClientConVar( "nametags_drawself", 1, true, false )
ply = LocalPlayer()
hook.Add("HUDPaint","drawnametags",function()
local EnableLabels = GetConVarNumber("nametags_enable")
local DrawName= GetConVarNumber("nametags_drawname")
local DrawRank = GetConVarNumber("nametags_drawrank")
local DrawSelf = GetConVarNumber("nametags_drawself")
if EnableLabels > 0 then
for id, target in pairs(ents.FindByClass("Player")) do
if target:Alive() then
local name = tostring(target:Nick())
local targetPos = target:GetBonePosition(target:LookupBone("ValveBiped.Bip01_Head1") ) + Vector(0,0,20)
local targetDistance = math.floor((ply:GetPos():Distance(targetPos))/40)
local targetScreenpos = targetPos:ToScreen()
// Varibles
local yName = targetScreenpos.y - targetDistance - 35
local Multiplier = 25
// Draw Name
local TeamColor = team.GetColor( target:Team())
local finishedcolor = ColorAlpha( TeamColor, 255 - targetDistance*Multiplier )
local rankcolor = finishedcolor - Color(55,55,55)
if target:GetNWBool("IsVanished") == true then
else
if DrawName > 0 then // Draw Name
draw.DrawText( string.upper(target:Name()), "DermaLarge", targetScreenpos.x, yName, finishedcolor, 1 )
end
if DrawRank > 0 then // Draw Rank
draw.DrawText( string.upper(target:GetUserGroup()), "ChatFont", targetScreenpos.x, yName + 27, rankcolor, 1 )
end
end
else
end
end
end
end)
You can use util.TraceLine() to check fully visibleness of player.
The solution is easy to use but the catch is it's a line, so if only this vector is visible whole drawing renders.
Either way is to use util.PixelVisible(). It has radius thing which can be more useful in this way.
If you want me to create a code example or finish your code, reply next
Honestly i dont know tracing works i will look into it but if you finish it would be nice too
Sorry, you need to Log In to post a reply to this thread.