Help!

I’m trying to create a toolgun that can modify a networked bool of an entity. I’ve got this VGUI code:

[LUA]
function TOOL.BuildCPanel(panel)
panel:AddControl(“Header”, {
Text = “#Tool_wire_moneydetector_name”,
Description = “#Tool_wire_moneydetector_desc
})
panel:AddControl(“CheckBox”, {
Label = “Detect Money Printers”,
Command = “wire_moneydetector_mp”
})

panel:AddControl("CheckBox", {
  Label = "Detect Bank Vaults",
  Command = "wire_moneydetector_bv"
})

panel:AddControl("CheckBox", {
  Label = "Detect Money",
  Command = "wire_moneydetector_m"
})

    ModelPlug_AddToCPanel(panel, "moneydetector", "wire_moneydetector", "#WireMoneyDetectorTool_model", nil, "#WireMoneyDetectorTool_model")

end
[/LUA]

And the following code for creating the entity:

[LUA]
function TOOL:LeftClick(trace)
if not trace.HitPos or trace.Entity:IsPlayer() then return false end
if CLIENT then return true end

local ply = self:GetOwner()

if not self:GetSWEP():CheckLimit("wire_moneydetector") then return false end

local DETM	= self:GetClientNumber('m') ~= 1
local DETMP	= self:GetClientNumber('mp') ~= 1
local DETBV	= self:GetClientNumber('bv') ~= 1

local Ang = trace.HitNormal:Angle()
Ang.pitch = Ang.pitch + 90

local moneydetector = MakeWireMoneyDetector(ply, self.Model, Ang, trace.HitPos, DETM, DETMP, DETBV)

local min = moneydetector:OBBMins()
moneydetector:SetPos(trace.HitPos - trace.HitNormal * min.z)

local const, nocollide
if trace.Entity:IsValid() then
	const, nocollide = constraint.Weld(moneydetector, trace.Entity, 0, trace.PhysicsBone, 0, true)
end

moneydetector.Entity:GetPhysicsObject():SetMass(3)
duplicator.StoreEntityModifier(moneydetector, "MassMod", {Mass = 3})

undo.Create("WireMoneyDetector")
	undo.AddEntity(moneydetector)
	undo.AddEntity(const)
	undo.SetPlayer(ply)
undo.Finish()

ply:AddCleanup("wire_moneydetector", moneydetector)
ply:AddCleanup("wire_moneydetector", const)

return true

end
[/LUA]

What am I doing wrong, answer quick if you can. Thanks in advance!

Not sure, but is it,

[LUA]local DETM = self:GetClientBool(‘m’) ~= 1[/LUA]

for checkboxes, not sure. I can’t find documentation of this on the wiki

Correct me if I’m wrong, but I’m pretty sure that
[lua]
panel:AddControl(“CheckBox”, {
Label = “Detect Money”,
Command = “wire_moneydetector_m” – This
}) [/lua]

Command sets a clientside/serverside command when the checkpoint is pressed, whereas you could just type wire_moneydetector_m 1 to detect money

Like a console variable or runs a console command. Not sure what you mean

Console variable, I’m pretty sure that it is that, so you have to create a convar clientside to make it work.

How would I do this?

**[G.CreateClientConVar

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.CreateClientConVar)**

Can you explain exactly how to do that?

[lua]
local omfgItIsSoSIMPLE = CreateClientConVar(“wire_moneydetector_m”, 0, false, false)
– And then you check what it is with
omfgItIsSoSIMPLE:GetInt()
– instead of that checklimit crap
[/lua]

I don’t know how TOOL.ClientConVar works, so that’s the best you can get from me.