Overlaying an image on players using a weapon.

Hey all,

I’m trying to create a weapon that, when used, will overlay a .vtf file on their screen.

I have all the rest of the code for the weapon except for the overlaying part, and I have no idea how to do it.
My main question is what code do I use.


You can use

SWEP:DrawHUD to draw on the screen while the weapon is in use. To draw an image, use


local ourMat = Material(“models/wireframe”) – Calling Material() every frame is quite expensive

function SWEP:DrawHUD()
surface.SetDrawColor(255, 255, 255, 255)
surface.SetMaterial(ourMat) – If you use Material, cache it!
surface.DrawTexturedRect(0, 0, 512, 512)