Setting cvars from Derma Frame

I am making a gamemode and I am making a small admin panel that allows you to control the weapons people can use. I am making custom cvars for every weapon (epic_weapon_pistol for the 9mm pistol) and attempting to change theme through a durma screen. You can see the screen here:

Each item looks like this

				local weapon_crowbar = vgui.Create( "DCheckBoxLabel" ) 
				weapon_crowbar:SetText( "Crowbar" ) 
				weapon_crowbar:SetConVar( "epic_weapon_crowbar" ) 
				weapon_crowbar:SetValue( GetConVarNumber("epic_weapon_crowbar") ) 
				weapon_crowbar:SizeToContents() -- Size it to the list's size
			WeaponList:AddItem( weapon_crowbar ) -- Add the item above 				

The changes are applied client side, but that isn’t good enough. I need them changed server side.

I can tell they are change client side because I type epic_weapon_crowbar in the console and it shows 0 if unchecked and 1 if check. On the server it is always 1 (the default).

Thanks guys.


What is really odd is that the client remembers the cvar settings in between sessions.

CreateClientConVar( string convarName, string or number default, bool shouldSave, bool userdata )

Make the last variable true and it will update on the server. If you don’t want it to save make the second to last variable false.

Also please don’t PM me asking for help. Your thread has only been up for an hour.

sorry about PM’ing you, I really shouldn’t have done that.

That creates the console varible for me but I can’t access it via ply:GetInfo(‘convarName’) like I should.


it just returns an empty string


also, one convar out of the 20 is actually being passed but I can’t figure out why. I added it later then the other ones because I realized the omission.

i fixed it by reinstalling my gmod client.