Easy way to display text above a players head?

As the title says, is there a simple way to display text over a players head, for examples the players name?

Cheers in advance!

[lua]hook.Add( “HUDPaint”, “PaintName”, function()
for k, ent in ipairs(player.GetAll()) do
local dist = LocalPlayer():GetPos():Distance(ent:GetPos())
local BoneIndx = ent:LookupBone(“ValveBiped.Bip01_Head1”)
local pos = ent:GetBonePosition( BoneIndx )
pos.z = pos.z + 10 + (dist * 0.0325) --Makes it move up the further away you are…
local ScrnPos = pos:ToScreen()
draw.SimpleText( ent:Nick(), “ScoreboardText”, ScrnPos.x, ScrnPos.y, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
end)
[/lua]

Untested, but should work nicely.

Thanks for the quick reply, I shall test this when I get home!

Cheers!

Does this work?
I would like to know about this too.

I would assume it does, why don’t you try it for yourself? Join a server then run the script.

It works but you can also see your own name in the middle of the screen, fix anyone?

[lua]
hook.Add( “HUDPaint”, “PaintName”, function()
for k, ent in ipairs(player.GetAll()) do
if ent != LocalPlayer() then
local dist = LocalPlayer():GetPos():Distance(ent:GetPos())
local BoneIndx = ent:LookupBone(“ValveBiped.Bip01_Head1”)
local pos = ent:GetBonePosition( BoneIndx )
pos.z = pos.z + 10 + (dist * 0.0325) --Makes it move up the further away you are…
local ScrnPos = pos:ToScreen()
draw.SimpleText( ent:Nick(), “ScoreboardText”, ScrnPos.x, ScrnPos.y, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
end
end)
[/lua]