HUD Help, surface.drawoutlinedrect to accurately track a players health/armor/ammo/etc! HELP!

Please help, I am in need of help for a surface.DrawOutlinedRect to draw the size of a players name for example if my name is Mango, it will auto size it to be the same size as “Mango”, please help, thank you in advanced!

To do this, you need to set the font, then calculate the size, then add a buffer, move the box to the left by width/2 and up height / 2

[lua]// Vars
local _text = Player:Nick( );
local _buffer = 4;
local _x = 100;
local _y = 100;

// Set the font, otherwise GetTextSize won’t return a proper result for your text
surface.SetFont( “Default” );
local _w, _h = surface.GetTextSize( _text );

surface.DrawOutlinedRect( _x - _buffer / 2, _y - _buffer / 2, _w + _buffer, _h + _buffer );[/lua]