I have made a 3D2D hud above player's heads, but it goes invisible when in front of a prop.
Screenshot:
http://steamcommunity.com/sharedfiles/filedetails/?id=1344083859
client hud
local function Custom_DrawName( ply )
if ( !IsValid( ply ) ) then return end
if ( ply == LocalPlayer() ) then return end
if ( !ply:Alive() ) then return end
local Distance = LocalPlayer():GetPos():Distance( ply:GetPos() )
if ( Distance < 350 ) then
local offset = Vector( 0, 0, 85 )
local ang = LocalPlayer():EyeAngles()
local pos = ply:GetPos() + offset + ang:Up()
ang:RotateAroundAxis( ang:Forward(), 90 )
ang:RotateAroundAxis( ang:Right(), 90 )
surface.SetFont( "custom_hud_nameplate_font" )
local PlyNameX, PlyNameY = surface.GetTextSize( ply:Nick() )
PlyNameX = PlyNameX + 20
cam.Start3D2D( pos, Angle( 0, ang.y, 90 ), 0.05 )
draw.DrawText( ply:Nick(), "custom_hud_nameplate_font", -10, 100, Color( 200, 200, 200, 255 ), TEXT_ALIGN_CENTER )
local usergroupTxt = tostring(ply:GetNWString("usergroup"))
for k, v in pairs( CustomHUD.Config.UlxRankNames ) do
if( usergroupTxt == k ) then
usergroupTxt = v[1]
end
end
if( usergroupTxt != nil and ply:getDarkRPVar( "job" ) != nil ) then
surface.SetFont( "custom_hud_nameplate_font_sm" )
local jobgroupX = surface.GetTextSize( usergroupTxt .. " | " .. ply:getDarkRPVar( "job" ) )
surface.SetTextPos( -10-(jobgroupX/2), 185 )
surface.SetTextColor( 255, 50, 50, 255 )
surface.DrawText( usergroupTxt )
surface.SetTextColor( 255, 255, 255, 255 )
surface.DrawText( " | " )
surface.SetTextColor( team.GetColor(ply:Team()) )
surface.DrawText( ply:getDarkRPVar( "job" ) )
end
cam.End3D2D()
end
end
hook.Add( "PostPlayerDraw", "Custom_HUD_DrawName", Custom_DrawName )
Thanks in advance, I couldn't find anything online about it!
Try changing the hook to PostDrawOpaqueRenderables
PostPlayDraw only works on playerbounds regarding 3d2d shit, as far as I know.
Just use PostDrawTranslucentRenderables
Sorry, you need to Log In to post a reply to this thread.