I’m fairly new to Lua, GLua, & VGUI. I can’t seem to create a GUI that I’m able to open with chat commands as well as editing the settings for my addon. I do know that in order to open the GUI via a chat commands requires net.Send & net.Receive. Any help is greatly appreciated and I would like to thank you in advance for your help.
What have you achieved so far?
You don’t necessarily need to use the net library for chat command VGUI stuff - you can do something like this:
hook.Add( 'OnPlayerChat', 'somename', function( ply, txt, bTeam, bDead ) txt = string.lower( txt ) -- make the string lower case if txt == '/opengui' and ply == LocalPlayer() then -- if the player typed /opengui and it's actually you then -- open the vgui stuff return true -- this suppresses the message from being shown end end )
Since the OnPlayerChat hook is clientside, no networking is needed
By the way, that thing above was a modification of the example on the wiki (which I wrote :P)
Won’t that open for all clients?
I actually can’t remember, but I don’t think it would considering it’s a clientside hook, but I’m probably wrong
I changed the example thing so it won’t screw up if that’s actually the case
It will, thats why it has ply argument also.