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 [CODE]For using this tag use [.CODE]TEXT[./CODE] without the .[/CODE] tags
You are not setting the draw color.
[QUOTE=Robotboy655;42453439]You are not setting the draw color.[/QUOTE]
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.
[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)
[/code]
Here is also my .mtf for the glitchy graphic.
[code]"LightmappedGeneric"
{
"$basetexture" "hud/hudcd"
"$translucent" 1
}
[/code]
Thanks in advance!
"LightmappedGeneric" should be "UnlitGeneric"
NOPE figured it out. The vmt has to be this.
[code]"UnlitGeneric"
{
"$basetexture" "changeme"
"$vertexcolor" 1
"$vertexalpha" 1
"$translucent" 1
}[/code]
:3 SOLVED!
Sorry, you need to Log In to post a reply to this thread.