Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- surface.CreateFont( "NickFont", {
- font = "Roboto",
- size = 35,
- weight = 500,
- antialias = true,
- } )
- surface.CreateFont( "NickFontSmall", {
- font = "Roboto",
- size = 25,
- weight = 500,
- antialias = true,
- } )
- local constant = 0.3
- local colors = {}
- local function findRandomColor( ply )
- colors[ply:Nick()] = Color( math.random( 2, 17 ) * 15, math.random( 2, 17 ) * 15, math.random( 2, 17 ) * 15 )
- end
- for id, ply in pairs( player.GetAll() ) do
- findRandomColor( ply )
- end
- hook.Add( "PostDrawTranslucentRenderables", "PlyNames", function()
- for id, ply in pairs( player.GetAll() ) do
- local offset
- if !colors[ply:Nick()] then
- findRandomColor( ply )
- end
- if ply:Crouching() then
- offset = Vector( 0, 0, ply:OBBMaxs().z + 30 )
- else
- offset = Vector( 0, 0, ply:OBBMaxs().z + 10 )
- end
- local distance = LocalPlayer():GetPos():Distance( ply:GetPos() )
- local pos = ply:GetPos() + offset
- local ang = EyeAngles()
- local alpha = math.Min( - ( distance * constant ) + 255, 255 )
- local color = Color( 0, 0, 0, alpha )
- colors[ply:Nick()].a = alpha
- ang:RotateAroundAxis( ang:Forward(), 90 )
- ang:RotateAroundAxis( ang:Right(), 90 )
- if ply != LocalPlayer() and ply:Alive() and distance < 900 then
- cam.Start3D2D( pos, ang, 0.25 )
- draw.SimpleTextOutlined( ply:GetName(), "NickFont", 2, -30, colors[ply:Nick()], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color )
- draw.SimpleTextOutlined( team.GetName( ply:Team() ), "NickFontSmall", 2, -2, colors[ply:Nick()], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color )
- cam.End3D2D()
- end
- end
- end )
- hook.Add( "HUDDrawTargetID", "DisableID", function() return false end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement