SWEP:DrawHUD Function not working

I’ve been trying to get a SWEP to draw a PNG material(the guns image) using the following code:

[lua]function SWEP:DrawHud()
if ply:Alive() then
local mat = Material(innocent.png)
surface.SetDrawColor (255,255,255,255)
surface.SetMaterial (mat)
surface.DrawTexturedRect(125,125,125,125)
end
end
[/lua]

It either refuses to draw the image to hud or it’ll draw the image and then once dropped refuse to be picked up by the player. Any hints as to what’s going wrong? I have two lua files one in lua/weapons and the other in gamemodes/ents…/weps… both with the same lua inserted at the end of the SWEP.

You are not using it correctly



local mat = Material("innocent.png")
function SWEP:DrawHud()
	surface.SetDrawColor (255,255,255,255)
	surface.SetMaterial (mat)
	surface.DrawTexturedRect(125,125,125,125)
end

[editline]21st December 2013[/editline]

And you don’t need the file in 2 folders, choose only 1 of them.

Thank you that makes it ALOT clearer where I’ve gone wrong.

Also, remember, that this section is not for coding help. This is.

Duely noted! Ty