I’m fairly new to lua and I’ve only really learnt the basics so far, Though I’m hoping for abit of help on creating the name system that hovers above players heads, I’m assuming it is a HUD? I’f so I can work most of it out except for how you would keep it to the players head. If anybody could help me out with that little of information I’d greatly appreciate it. =D
hook.Add(“HUDPaint”, “Draw Names”, function()
for k, v in pairs( player.GetAll() ) do – Loop through all the players.
if ( IsValid(v) and v:Alive() ) then – Make sure they’re valid and alive.
local name = v:Name(); – Store their name into a variable.
local position = v:GetPos(); – Get their world position.
local screenPos = position:ToScreen(); – Where to draw based off position.
local color = team.GetColor( v:Team() ); – Get their team color.
draw.SimpleText(name, "ChatFont", screenPos.x, screenPos.y, color, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER); -- Draw the stuff. end; -- End the valid and alive if statement. end; -- End the loop.
end); – End of the hook’s function.
Thank you verymuch (: