Unknown command

Hey i need help with this command…


//Server side

concommand.Add( "Panel", PointSystemPanel )


hook.Add("PlayerSay", "Panel", function(ply, text)
	if text == "!ola" then
		ply:ConCommand("Panel")
	end
end)


// Client side

concommand.Add( "Panel", PointSystemPanel )

Sometimes it opens the panel for me, but most of time it says unknown command “Panel” , maybe this is because i dont really know where to put it in lua…
I have cl_init in autorun/client and init.lua in autorun/server.

You don’t have to create a new thread…

You don’t need to create the concommand per realm (you’ve created it clientside and server)

your also using PlayerSay wrong

For chat commands from the client you can do this:




//serverside
hook.Add("PlayerSay", "CoolChatCom", function(ply, text)
     if(string.sub(text, 1, 7 ) == "!killme" ) then
          ply:Kill()
     end
end


or using concommands you can do this:



--client side
function ExampleCom ()

 print("hello")

end

concommand.Add( "RunPrint", ExampleCom)




--Serverside

hook.Add("PlayerSay", "CoolChatCom", function(ply, text)
     if(string.sub(text, 1, 9 ) == "!runprint" ) then
          ply:ConCommand( "RunPrint" ) 
     end
end


then in console type “RunPrint” and that runs the console command or type in chat !runprint and that will also run it (prints “hello” into the console). Hope it helps!

Tnx for that but it doesnt work. -.-

Whoops made a little mistake let me edit it

Edit:

Use the code I gave now.

Yea its working but like i said on the start. When i restart the server and type the command, the server will give me Unknown Command, but if i change something in lua files or i just like save the file and dont change nothing it will work than, but when i restart the server it will do it again…