Set an icon in my hud. (DarkRP)

Hello, I want this “icon16/money.png” icon in my hud…
But how do I put it there, somehow?

In the vgui.lua there is like


		F4MenuTabs:AddSheet("Money/Commands", F4Tabs[1], "icon16/money.png", false, false)

and I want the icon to be placeable somewhere… help please…

I am pretty new to LUA and I am learning… so yeah :smiley:

[editline]31st January 2013[/editline]

Never mind, found this:



	surface.SetTexture(surface.GetTextureID("icon16/money.png"))
	surface.DrawTexturedRect(25 + 10,ScrH() - 140,16,16)


But appears as the texture does not exist(black and purple.)

Place where? Like at the end of tab or move it out of the F4Menu completely? If you want this in hud, check hud.lua. You can add icons with surface.SetMaterial, google the surface functions if that’s what you want.

Ah, found it out why it was like an error.
Because that texture didn’t exist in single player… lol.

[lua]
surface.SetMaterial(Material(“icon16/money.png”))
surface.DrawTexturedRect(25 + 10,ScrH() - 140,16,16)
[/lua]
Don’t you have to put that instead?

Try this in


local function DrawGenericHud()


// Playername
surface.SetMaterial(Material("gui/silkicons/user"))
surface.SetDrawColor(255,255,255,255)
surface.DrawTexturedRect(Offset + 10, ((ScrH() - 165) - Offset) + 10, 16, 16)

Here a link for some Icons http://www.garrysmod.org/downloads/?a=view&id=54170

Why would you download those icons when they’re already on every single server? (The icon16 folder)
It’s much better than letting people download extra content.

Will try it, thanks.

Didn’t work, so I tried this from GunLicense function.
And it worked.
[lua]
local money = Material(“icon16/money.png”)
surface.SetMaterial(money)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRect(265 + 10,ScrH() - 37,16,16)
[/lua]