• Unknown command
    5 replies, posted
Hey i need help with this command... [CODE]//Server side concommand.Add( "Panel", PointSystemPanel ) hook.Add("PlayerSay", "Panel", function(ply, text) if text == "!ola" then ply:ConCommand("Panel") end end)[/CODE] [CODE]// Client side concommand.Add( "Panel", PointSystemPanel )[/CODE] 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 [url]http://wiki.garrysmod.com/page/Player/Say[/url] For chat commands from the client you can do this: [code] //serverside hook.Add("PlayerSay", "CoolChatCom", function(ply, text) if(string.sub(text, 1, 7 ) == "!killme" ) then ply:Kill() end end [/code] or using concommands you can do this: [code] --client side function ExampleCom () print("hello") end concommand.Add( "RunPrint", ExampleCom) [/code] [code] --Serverside hook.Add("PlayerSay", "CoolChatCom", function(ply, text) if(string.sub(text, 1, 9 ) == "!runprint" ) then ply:ConCommand( "RunPrint" ) end end [/code] 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. -.-
[QUOTE=HumulusLupulu;46386755]Tnx for that but it doesnt work. -.-[/QUOTE] 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...
Sorry, you need to Log In to post a reply to this thread.