Hud

http://img837.imageshack.us/img837/6463/hud.png

One of my vtfs has no fill (transparent) with just an outline, and one has a fill with the outline too.

I’m planning on using a heart vtf, but i want the red to go down as you lose health.
I was thinking on using DrawTexturedRect, but if you set the height to
( client:Health() / 100 ) *64 (The vtf is 64 * 64 ).
I realized that this would just shrink my second vtf (Which has the fill)

If you have any ideas, please inform me how and any examples.

[lua]
local texture1 = surface.GetTextureID( “hud1” );
local texture2 = surface.GetTextureID( “hud2” );

function hud()
local client = LocalPlayer()
if !client:Alive() then return end

	surface.SetDrawColor( 255, 255, 255, 255 );
	surface.SetTexture( texture1 );
	surface.DrawTexturedRect( 65, 65, 64, 64 )
	
	surface.SetDrawColor( 255, 255, 255, 255 );
	surface.SetTexture( texture2 );
	surface.DrawTexturedRect( 65, 65, 64, (client:Health() / 100 ) * 64 )

end

function hidehud( hud )
for k, v in pairs{ “CHudHealth”}do
if hud == v then return false
end;
end
end;
hook.Add( “HUDShouldDraw”, “hidehud”, hidehud )
hook.Add(“HUDPaint”, “hud”, hud)

[/lua]

The location of my vtfs is in gamemodename/content/materials

Thanks in advance.

This is what i was using, but it wouldn’t draw my hud.

Edit:
Oh and I know how to do the blue rectangle I do not need to know about. I can do that. :smiley:

This worked for me. I didn’t have your textures so I used plain rectangles.
[lua]
local function hud()
local client = LocalPlayer()
if !client:Alive() then return end

surface.SetDrawColor( 255, 255, 255, 255 );
surface.DrawOutlinedRect( 65, 65, 64, 64 )

surface.SetDrawColor( 255, 0,0, 255 );
surface.DrawRect( 65, 65, 64, (client:Health() / 100) * 64 )

end

function hidehud( hud )
if (hud == “CHudHealth”) then return false end
end

hook.Add( “HUDShouldDraw”, “hidehud”, hidehud )
hook.Add(“HUDPaint”, “hud”, hud)[/lua]