• Chat command - Quick Help Please!
    9 replies, posted
Hi, so all im trying to do is make a chat command that runs the console command "adminbuddy".. and i cant xD My code is: function myChatCommand( ply, text, public ) if( string.sub( text, 1, 5) == "/logs" ) then RunConsoleCommand("adminbuddy"); end end hook.Add( "PlayerSay", "myChatCommand", myChatCommand ) And it doesnt work, please help, thanks in advance! PS: i do have the tabs in they just didnt paste in the thread
[QUOTE=dhog10;44938150]Hi, so all im trying to do is make a chat command that runs the console command "adminbuddy".. and i cant xD My code is: function myChatCommand( ply, text, public ) if( string.sub( text, 1, 5) == "/logs" ) then RunConsoleCommand("adminbuddy"); end end hook.Add( "PlayerSay", "myChatCommand", myChatCommand ) And it doesnt work, please help, thanks in advance![/QUOTE] [code] if SERVER then function myChatCommand( ply, text, public ) if text == "/logs" then ply:ConCommand("adminbuddy"); end end hook.Add( "PlayerSay", "myChatCommand12", myChatCommand ) else print("you're not running this right, stop running it clientside") end [/code] try, ohhh i see now. you're making it run a console command on the server. one second, updating updated
so that should make the client run the command in console right?
[QUOTE=dhog10;44938277]so that should make the client run the command in console right?[/QUOTE] yes
ah it seems to work! thanks :D Only issue i see is it seems to bug the menu slightly, when opening it using the console command it open it normally and can be closed by pressing X but when i type /logs i have to press X 2 times to close it as it leaves a bugged empty page, its wierd idk but anyway it works thank you :)
[QUOTE=dhog10;44938313]ah it seems to work! thanks :D Only issue i see is it seems to bug the menu slightly, when opening it using the console command it open it normally and can be closed by pressing X but when i type /logs i have to press X 2 times to close it as it leaves a bugged empty page, its wierd idk but anyway it works thank you :)[/QUOTE] you make no sense [editline]29th May 2014[/editline] [QUOTE=dhog10;44938313]ah it seems to work! thanks :D Only issue i see is it seems to bug the menu slightly, when opening it using the console command it open it normally and can be closed by pressing X but when i type /logs i have to press X 2 times to close it as it leaves a bugged empty page, its wierd idk but anyway it works thank you :)[/QUOTE] are you running a for loop?
This ties ! and / commands directly to concommands: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/chat_commands/chat_commands.lua.html[/url]
Ok if i didnt make sense, when i enter the console command it opens the admin logging menu properly, when i use the chat command, it opens what looks like a normal logging menu but when i close it leaves a blank menu underneath that i have to close a second time, as if it enetered the command twice, but the second menu is blank and bugged
Show us the concommand.Add code.
Have you restarted the server?, When I code allot and update the code will server is running, sometimes it will run the new code twice, try restarting the server.
Sorry, you need to Log In to post a reply to this thread.