GUI Open Command

I have a GUI and I thought I had setup the net message correctly so that the chat command would open it, but apparently I was wrong. Here’s the code:

Chat Command



functionsTable["menu"] = function( ply, args )
	if plyHasPerms( ply ) then
		net.Start( "RASOpenConfigEditor" )
			net.WriteTable( RAS.Config )
		net.Send( ply )
	else
		RAS.ChatPrint( "You do not have permission to do this!", ply )
	end
end


GUI net.Receive



net.Receive("RASOpenConfigEditor", function()
		tbl = net.ReadTable()

		tfpick1 = tobool(tbl[RAS.Config.AntiSpamming])
		tfpick2 = tobool(tbl[RAS.Config.Chat.Enabled])
		tfpick3 = tobool(tbl[RAS.Config.Prop.Enabled])
		tfpick4 = tobool(tbl[RAS.Config.Sent.Enabled])
		tfpick5 = tobool(tbl[RAS.Config.Effect.Enabled])
		tfpick6 = tobool(tbl[RAS.Config.Ragdoll.Enabled])
		tfpick7 = tobool(tbl[RAS.Config.Vehicle.Enabled])
		tfpick8 = tobool(tbl[RAS.Config.Npc.Enabled])
-- GUI code from here down(didn't want the thread to be super long)


I also have util.AddNetworkString( “RASOpenConfigEditor” ) in the main addon lua file.

Are you sure that’s serverside?
Also, try printing the table once you’ve received it and see what happens

[editline]19th April 2016[/editline]

Also, are you sure about this?



tobool(tbl[RAS.Config.Npc.Enabled])


My guess is that RAS.Config.Npc.Enabled would be a bool, so you’re simply checking for keys of true or false in the table

Yep, it’s serverside.

As for the


tobool(tbl[RAS.Config.Npc.Enabled])

not really sure what you mean by ‘Are you sure about this?’ If your talking about the tobool part, it’s not really needed just there for my reassurance.

I’m just wondering if



RAS.Config.Npc.Enabled


Is a bool

Yes, it is.

So, you are wanting to check the table for a key that’s either true or false? That doesn’t make much sense to me

I’m wanting to get the current value of the table (true or false) so that I can set a checkbox to be checked or un-checked. As well as letting the user change it’s value using the checkbox.

Well, I think you’re doing it a bit wrong- what you’re doing is the equivalent to this:



tbl[true]
-- or
tbl[false]


Which would mean the table had to be indexed like this:



tbl = {
[true] = 'somevalue',
[false] = 'someothervalue',
}


[editline]19th April 2016[/editline]

So you’d literally be just checking one of two values

Do have any idea on how I can do what I stated above?

Well, since the table you’re writing and reading already seems to be the RAS.Config table, try doing



tobool(tbl.AntiSpamming)


Rather than



tobool(tbl[RAS.Config.AntiSpamming])


Unless you mean there’s a table on the client also called RAS.Config and you’re trying to change that

[editline]19th April 2016[/editline]

With the previous garbage I posted I was just trying to show you how you were indexing a bool since you didn’t seem to want to do that, but then again I’m not quite sure what exactly you’re trying to do, are you trying to check an existing table for something or set the table as the newly received one, or do something else?