Weapon Icon

Hello guys. I remember half life hud and when you choosing any weapon, there is an icon of that weapon. I want the same shit for my custom hud. Can you little bit help me with that coding? Thx.


Try this :

function WeaponIcon() -- Create the function

	local ply = LocalPlayer()
	local weapon = ply:GetActiveWeapon() -- Weapon on your hand
	surface.SetTexture( surface.GetTextureID( "vgui/entities/"..weapon:GetClass() ) ) -- Search icon of this weapon on vgui/entities/..
	surface.DrawTexturedRect( x, y, 128, 128 ) -- change x/y by the position. But don't change 128,128 ( vgui = 128x128 )


I have no images of guns in materials/vgui/entities :frowning: And i really dk which format they have to have or stuff…

What weapon icon you need?

Kinda, when im choosing crowbar, there is a crowbar appears on screen. Kinda like that. But with all other weapons. Can you help me out?

Well, the better idea are to create every pictures you need.