Surface.DrawTexturedRect not working?

Hey, I’m attempting to make a new hud for darkrp, so far I got the original gui to dissapear but when i try to add a new one from a vmt and vtf file, it doesn’t show… No errors, no purple/black checkered, just nothing there.

Here is the full code, edited from the darkRP modification addon.

It’s quite bare, because I don’t want to start coding until the frame of it is working.

local leftHUD = surface.GetTextureID(“hud/hudcd”)

local hideHUDElements = {
[“DarkRP_HUD”] = false,

["DarkRP_EntityDisplay"] = false,

["DarkRP_ZombieInfo"] = false,

["DarkRP_LocalPlayerHUD"] = true,

["DarkRP_Agenda"] = false

}

– this is the code that actually disables the drawing.
hook.Add(“HUDShouldDraw”, “HideDefaultDarkRPHud”, function(name)
if hideHUDElements[name] then return false end
end)

/---------------------------------------------------------------------------
The Custom HUD
---------------------------------------------------------------------------
/
local Health = 0
local function hudPaint()

ply = LocalPlayer()


//Provided HUD Image Drawing

surface.SetTexture(leftHUD)
surface.DrawTexturedRect(0,ScrH() - 173,32,32)

textX = 302

// Bars
barsX = 219
-- Health Bar
local y = ScrH() - 20
-- Armor Bar
local armor = ply:Armor()
if armor ~= 0 then
	draw.RoundedBox(2, x + 4, y - 15, (200 - 8) * armor / 100, 5, Color(0, 0, 255, 255))
end

end
hook.Add(“HUDPaint”, “DarkRP_Mod_HUDPaint”, hudPaint)

Use


For using this tag use [.CODE]TEXT[./CODE] without the .

tags

You are not setting the draw color.

I’ll try when I get home, hope it works! Thanks!!

Thanks! It draws now, but there is a weird graphical glitch going on, it only shows the colors of it sometimes and when looking at certain angles.
What could be the issue?

Revided code.



local leftHUD = surface.GetTextureID("hud/hudcd")

local hideHUDElements = {
	["DarkRP_HUD"] = false,

	["DarkRP_EntityDisplay"] = false,

	["DarkRP_ZombieInfo"] = false,

	["DarkRP_LocalPlayerHUD"] = true,

	["DarkRP_Agenda"] = false
}

-- this is the code that actually disables the drawing.
hook.Add("HUDShouldDraw", "HideDefaultDarkRPHud", function(name)
	if hideHUDElements[name] then return false end
end)



/*---------------------------------------------------------------------------
The Custom HUD
---------------------------------------------------------------------------*/
local Health = 0
local function hudPaint()
	
	ply = LocalPlayer()


	//Provided HUD Image Drawing
	
	surface.SetTexture(leftHUD)
	surface.SetDrawColor(255,255,255,255)
	surface.DrawTexturedRect(0,ScrH() - 173,466,173)
	
	textX = 302
	
	// Bars
	barsX = 219
	-- Health Bar
	local y = ScrH() - 20
	-- Armor Bar
	local armor = ply:Armor()
	if armor ~= 0 then
		draw.RoundedBox(2, x + 4, y - 15, (200 - 8) * armor / 100, 5, Color(0, 0, 255, 255))
	end
end
hook.Add("HUDPaint", "DarkRP_Mod_HUDPaint", hudPaint)


Here is also my .mtf for the glitchy graphic.


"LightmappedGeneric"
{
	"$basetexture" "hud/hudcd"
	"$translucent" 1
}


Thanks in advance!

“LightmappedGeneric” should be “UnlitGeneric”

NOPE figured it out. The vmt has to be this.


"UnlitGeneric"
{
 "$basetexture" "changeme"
 "$vertexcolor" 1
 "$vertexalpha" 1
 "$translucent" 1
}

:3 SOLVED!