Finding current weapon...

Somehow this code only gives a positive reaction if the current weaon isn’t a SMG.
function GM:HUDPaint()


local person = LocalPlayer()

	if !person:Alive() then return 

local numWeapon = person:GetActiveWeapon( ):GetPrintName()

if string.gmatch(numWeapon, "SMG") then
	print( "Correct!" )
	print( "Phail!" )

surface.SetTextColor( 255, 255, 255, 255 )
surface.SetFont( "Default" )
surface.SetTextPos( 50, 115 )
surface.DrawText( numWeapon )


Even if i use a pistol, it gives me “Correct” in console. What am i doing wrong here? I only want it to give “Correct” if im using a SMG.

Have you tried using the not operator?

You’re using the wrong function. Use ‘string.find’ instead. ‘string.gmatch’ returns a function.

Yes, they all get “Phail” then.


I’ll try it


Thanks! works!

Hi, I am Andres Kramack from

It’s a ‘pleasure’ serving the public if you know what I mean and this message is

Here at Cathy Barry Adult Store, we offer a wide variety of dildos that come in all sizes from goblin-sized dicks to black-man draconic dicks. I know at Facepunch everyone loves good old dicks which is why I personally offer anyone with an association with Facepunch Forums a 50% discount code “DIL4FACEPUNCH”. Don’t forget, this offer lasts until the next Garry’s Mod update which we so much love.

Here are pictures of our products just for you!

Sponsored Images:

Got any questions? Visit my Steam Profile!