Firstly, it isn’t working because your file path has ‘materials’ at the start of it. If you remove that bit it should work.
Secondly, you could do this without having to make a different image for every weapon by using a DModelPanel with the weapon’s model. Don’t create it every frame, though.
Thirdly, please cache that material! It even says to do that on the example of
surface.DrawTexturedRect. Using the Material function every frame is costly.
Fourtly, please create those variables locally rather than making them global, if they’re global, another script could accidentally use them and screw up your script.
This version of your code will probably work if you don’t want to use a DModelPanel:
local weapon = 'Whatever you want the default weapon image to be, or just nil'
if ply:GetActiveWeapon("weapon_smg1") then
weapon = Material( "serioushud/weapon_smg1_image.png" )
elseif ply:GetActiveWeapon("weapon_shotgun") then
weapon = Material( "serioushud/weapon_shotgun_image.png" )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( weapon )
surface.DrawTexturedRect( ScrW()/1.92, ScrH()/1.16, ScrW()/20.39, ScrH()/12 )