HUD Tutorial - VTF/VMT

Hey people, I’ve followed this tutorial (here)

And everything seems to be working, although with one problem.

I can’t see the money icons: money.vtf, money.vmt, money_add.vtf and money_add.vmt.

Here is my code:

[LUA]local function DoActualHUD()

–If the variables table has not be initialized, initialize it
LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {}

–If the money is not set, don’t do anything
local v1 = LocalPlayer().DarkRPVars.money
if not v1 then v1 = “” end

–If the salary is not set, don’t do anything
local v2 = LocalPlayer().DarkRPVars.salary
if not v2 then v2 = “” end

draw.RoundedBox(5, 25, ScrH() - 175, 200, 150, Color(25,25,25,200))
surface.SetDrawColor(255,255,255)

surface.SetTexture(surface.GetTextureID(“gui/silkicons/user”))
surface.DrawTexturedRect(25 + 10,ScrH() - 160,16,16)

surface.SetTexture(surface.GetTextureID(“gui/silkicons/money”))
surface.DrawTexturedRect(25 + 10,ScrH() - 140,16,16)

surface.SetTexture(surface.GetTextureID(“gui/silkicons/money_add”))
surface.DrawTexturedRect(25 + 10,ScrH() - 120,16,16)

surface.SetTexture(surface.GetTextureID(“gui/silkicons/group”))
surface.DrawTexturedRect(25 + 10,ScrH() - 100,16,16)

surface.SetTexture(surface.GetTextureID(“gui/silkicons/heart”))
surface.DrawTexturedRect(25 + 10,ScrH() - 80,16,16)

surface.SetTexture(surface.GetTextureID(“gui/silkicons/shield”))
surface.DrawTexturedRect(25 + 10,ScrH() - 60,16,16)

draw.SimpleText(LocalPlayer():Nick(),“TargetID”, 25 + 30,ScrH() - 165, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
draw.SimpleText("" .. v1,"TargetID", 25 + 30,ScrH() - 145, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) draw.SimpleText("" … v2,“TargetID”, 25 + 30,ScrH() - 125, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
draw.SimpleText(LocalPlayer().DarkRPVars.job,“TargetID”, 25 + 30,ScrH() - 105, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
draw.SimpleText(LocalPlayer():Health() ,“TargetID”, 25 + 30,ScrH() - 85, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
draw.SimpleText(LocalPlayer():Armor() ,“TargetID”, 25 + 30,ScrH() - 65, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)

end[/LUA]

My icon files (money.vtf, money.vmt, money_add.vtf and money_add.vmt) are in the server directory of


garrysmod/materials/gui/silkicons

Now, if i put these icons into my local garrysmod folder in the same directory path, it works perfectly, so i think my problem is downloading the files, or including maybe.

I have updated my FastDL and it hasn’t done anything, i’ve even tried wiping my FastDL to remove past items, for a clean setup - still no positive outcome…

Any help would greatly be appreciated.

Adam.

I’m not an Expert But you could always try do this:


surface.SetTexture(surface.GetTextureID("materials/gui/silkicons/user"))
surface.DrawTexturedRect(25 + 10,ScrH() - 160,16,16)
  
surface.SetTexture(surface.GetTextureID("materials/gui/silkicons/money"))
surface.DrawTexturedRect(25 + 10,ScrH() - 140,16,16)
  
surface.SetTexture(surface.GetTextureID("materials/gui/silkicons/money_add"))
surface.DrawTexturedRect(25 + 10,ScrH() - 120,16,16)
  
surface.SetTexture(surface.GetTextureID("materials/gui/silkicons/group"))
surface.DrawTexturedRect(25 + 10,ScrH() - 100,16,16)
  
surface.SetTexture(surface.GetTextureID("materials/gui/silkicons/heart"))
surface.DrawTexturedRect(25 + 10,ScrH() - 80,16,16)
  
surface.SetTexture(surface.GetTextureID("materials/gui/silkicons/shield"))
surface.DrawTexturedRect(25 + 10,ScrH() - 60,16,16)

It could’t hurt…

This won’t fix your problem, but it’s better to put surface.GetTextueID(textureName); outside your function.

I gave it a shot, doesn’t work. Thanks anyway.

I don’t know how to do that at all, I’m only running of tutorials.

But like I said, i think the problem here is with actually downloading the files from the server.

Bump, any help please?

You simply make a variable refering to the variable the function returns

[lua]
local texOne = surface.GetTextureID(“texturename”);
[/lua]