Look at this simple code:
local function testcc( ply, cmd, args ) print( SERVER and "sv" or "cl" ) end concommand.Add( "testcc", testcc )
Put this code in a file in lua/autorun, in both your game and on a dedicated server. Then do the following:
1 - Start Gmod and your dedicated server
2 - Start a Single Player game, type “testcc” from in-game console, it will print “sv”. This is normal behavior, but doing this step (starting Single Player game just after starting Gmod) is what’s causing the issue described in the next step.
3 - Connect to the dedicated server, type “testcc” from in-game console: problem! It should print “cl” in the in-game console, but instead, it prints “sv” in the server console.
4 - Restart Gmod (you don’t need to restart dedicated server)
5 - Connect to the dedicated server, type “testcc” from in-game console, this time it will now print “cl”, as it should.
6 - From now on, until Gmod is closed, the problem will not happen: you can disconnect from dedicated server and start a Single Player game: command will print “sv”, reconnect to dedicated server: it will print “cl”, etc…
So it appears to me that there is a bug if you first start a Single Player game and then connect to a dedicated server, like if the concommand wasn’t “unregistered” correctly from the Single Player session.
Should I make a bug report on Github ? Done anyway: https://github.com/Facepunch/garrysmod-issues/issues/1902