Problems That Don't Need Their Own Thread v3.0

Previous thread hit max posts, thought I’d re-make it.

Welcome to Problems That Don’t Need Their Own Thread v 3!
Have a small problem you can’t figure out, but don’t believe it’s worth creating a whole new thread
for the sole purpose of getting your problem fixed? Then you’ve come to the right thread!

To keep the thread clean,

  • Post your problem ‘Variable returns nil at some point’, for example.
  • Post the code that you think is necessary to solve this problem.
  • Post the error that you are getting. For example, ‘[ERROR] gamemodes/skeleton/gamemode/client/hud.lua:70’
  • Media that can describe the problem better than words would help a lot in most cases.
  • Wrap code tags around your code. For example,

[lua]print “codens here”[/lua]

Remember to put the lua/code tags; [noparse][lua] <code> [/lua][/noparse]

  • Please do not spam your problem (when you don’t get any response, it means that other people are not familliar with your problem)


  • Please don’t ask for help when it comes to content that isn’t yours. Contact the creator instead, we don’t want you’re leaked content!
  • Before creating a post, I suggest you have a look at some coding sources such as;

Official Garry’s Mod Wiki:
Old Garry’s Mod Wiki. Has more examples: (long url)
Garry’s Mod GitHub ( The Lua files of Garry’s Mod ):

Previous Threads:

Exho beat you, but your logo is better than his, so you’ve got that going for you

From last thread, never answered (I was the last post)

How can I get if a convar is changed and update a paint hook.

Well this is awkward

whats the command to send the viewmodel animation speed of a weapon?

I was wondering when someone was gonna make a new thread.

Repost from last thread for all you to know how much of a noob I am :slight_smile:

I’m getting an error with the following code (code is clientside):[lua]
function SWEP:CreateShell(sh)
if IsValid( self.Owner ) && self.Owner:Alive() then
vm = self.Owner:GetViewModel()

	att = vm:GetAttachment(2)         // This is coming up NULL

Any ideas as to why that line would be coming up null? The players are holding a (should be) valid primary weapon. :stuck_out_tongue:

I believe you have to use callbacks for them ( As for updating a paint hook, it becomes tricky because you cant conditionally fun a paint hook. I mean, if you have a HUDPaint hook for example it will always get called, so you need to have some check for a value so you might need to cache the values of the convar you are tracking and check that.

[editline]29th March 2015[/editline]

Also, 2 of my posts from the old thread are still unanswers if anyone can help?

If I print my UserGroup serverside it’s perfectly fine and I’m superadmin, but clientside I am ‘user’

Is this evolve being weird or anyone else had an issue like this?

Make sure your server is up to date.

[lua] render.ClearStencil()
		render.SetBlend(0) --don't visually draw, just stencil
		self:SetModelScale(1.0,0) --slightly fuzzy, looks better this way
		cam.Start3D2D(Pos + Ang:Up()*1 + Ang:Right()*4+ Ang:Forward() * -2, TextAng, 0.3)
			draw.WordBox(1, -170, -22,self:GetNWString("TestText"), "Default", Color(0, 0, 0, 0), Color(0, 0, 150, 255))//Color(255,255,255,self:GetNWInt("AlphaChannel", 255)))	


I can’t seem to set the angles of a ClientsideModel in PostPlayerDraw, I can set the position fine. Doing the same code in Think works fine with angles except position lags behind.

ang = client:GetAngles()
			if pos then
				model, pos, ang = data.offset( client, model, pos, ang )

Is there anyway to get the position of a docked panel? I have a DFrame, DLabel and DTextEntry. The DLabel and DTextEntry are both parented to the DFrame and the DLabel is docked to the top and I’m trying to position the DTextEntry to the right of the DLabel but when I try to get the position of the DLabel, I only get 0, 0. I have tried DLabel:GetPos and DFrame:GetChildPosition(DLabel) and they both return 0, 0.

Try adding
render.SetStencilTestMask(0)[/lua] after its finished. It fixed a similar issue I was having, I’ve seen it or something similar mentioned before in regards to garrys halos and stencils behaving badly together.

Managed to find the command but I’m having trouble with it.

I’m setting the playback rate of the viewmodel to 0.5 using this


is a serverside script

but in a shared weapon script


its printing 1 for both client and shared

i can’t seem to get SetLocalModelLights to work, killburn said it needs to be used in conjunction with SuppressEngineLighting, but the model just remains fullbright no matter what I do.

local lights = { }

lights[ "light" ] = { MATERIAL_LIGHT_POINT, Color( 255, 0, 0 ), Vector( 16, 160, 72 ), Vector( 0, 0, 0 ), 0, 5, 45, 45, 1000, 10000, 0, 0, 1 }

	hook.Add( "PostDrawOpaqueRenderables", "kips", function( )
		render.SuppressEngineLighting( true )
		render.SetLocalModelLights( lights )
		for k, v in pairs( models ) do
			v:DrawModel( )
		render.SuppressEngineLighting( false )
	end )

thx. but I solved it

My DIconLayout should be showing icons but isn’t. Pretty sure the code is right.

local iconlist = vgui.Create("DIconLayout",plyslot)
	--if ply:GetFriendStatus() == "friend" then
		local icon_friend = iconlist:Add("DImage")

Results in

Why are you bothering with DIconLayout if you are only adding one icon?
That panel is useful for adding large quantities of icons.

I’m only testing it with one icon for the moment, would it work better if there was more icons?

No, you’ll have to debug this yourself though ( GetSize, check parent after adding new icons, search for examples, etc ).