Surface.SetTexture + surface.DrawTexturedRect



surface.SetTexture(surface.GetTextureID("materials/noobshud/healthbar"))
surface.DrawTexturedRect(ScrW()-ScrW(),ScrH()-ScrH()/4,500,250)


That’s what i’m using and i’ve placed healthbar.vtf in my garrysmod/garrysmod/materials/noobshud/ folder
and for some reason it won’t display it just keeps telling me i don’t have it, and i’m not sure why.

Can anyone help me on this one?

First of all, you don’t need “materials/” part of path, second of all, do you have corresponding .vmt file in same directory as .vtf?
By the way you can use PNG textures, it doesn’t require dicking around with .vmt/.vtf pairs. Something like this:



local tex = Material("path/myfile.png", "smooth")
hook.Add("HUDPaint", "something", function()
    surface.SetDrawColor(color_white)
    surface.SetMaterial(tex)
    surface.DrawTexturedRect(10, 10, 300, 300)
end)


Changed it to png and it worked thank you.