Ok so after a somewhat long search I have found that all my concommand.Add should be on my shared.lua (like Watercycle said in his code example) and that I should not include my cl_init.lua in my init.lua.
Now I have a problem, all of my console commands that I created (like testvgui) through concommand.Add are unknown.
In my init.lua I have:
[lua]AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )[/lua]
I put the code example that Watercycle gave me in lua/autorun/test.lua and I get unknown command for “testvgui” anyway.
Only way I can get my condommand.Add commands to actually run functions is by placing them in my init.lua.
Anyone willing to give a hand here?
Any help would be really appreciated, this is kinda holding me back on my first gamemode development.
[editline]25th December 2012[/editline]
So, me and a friend are taking a look at this and learning as we go. What happens is he also tried to make a Derma Panel base and his works and mine doesn’t. Now what fascinates me the most is that our code is identical basicly.
local function wawlol()
local DermaPanel = vgui.Create( “DFrame” ) // Create the frame in a local variable
DermaPanel:SetPos( 100, 100 ) // Set the position to 100, 100 ( x, y )
DermaPanel:SetSize( 300, 200 ) // Set the size to 300, 200 pixels
DermaPanel:SetTitle( “My new Derma frame” ) // Set the title
DermaPanel:SetVisible( true ) // Can you see it? ( Optional - default true )
DermaPanel:SetDraggable( true ) // Can you move/drag it? ( optional - default true )
DermaPanel:ShowCloseButton( true ) // Can you see the close button ( reccomended ) ( optional - default true )
DermaPanel:MakePopup() // Make it popup
concommand.Add( “waw”, wawlol )
And his is:
local function testone()
local DermaPanel = vgui.Create( “DFrame” )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 250, 250 )
DermaPanel:SetTitle( “Testing Derma Stuff” )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
concommand.Add( “testone”, testone )[/lua]
As you can see I even tried changing my function name but with no success.
The code is in a lua file which is in lua/autorun (shared).