How would I block a concommand from being used in the console? I want to it to exist, but you cannot use it in console. You would have to use it in a button or something.
Let me re-word this:
I want a concommand to exist, but the player cannot access it through the console. How can I do that?
Don’t use a console command, use usermessages or something like that.
No he wants to BLOCK the use of console commands. :psyduck:
From what I understand, he has a console command that he created that when run, runs a function. What I am saying is the whole point of console commands is hat they can be run from the console. The easiest way to do this would to be not using console commands at all, but usermessages or sendlua.
Ah! I get what you are saying.
Now that I think of it though, he could just add an IsAdmin check to prevent players from using it if he still really wants to use concommands…
Uh, the console commands are supposed to be used by the player, but not in a direct way.
Usermessages and SendLua are serverside only, so that leaves you with console commands and datastreams (= console commands / should be avoided).
Datastreams would probably be the way to go!
Send the return from util.CRC(CurTime()) as the first argument. On the server, if the first argument isn’t equal to the CRC of CurTime() (± 1) then ignore the command.
lua_run RunConsoleCommand("command",util.CRC(CurTime()),"more args")
Or am I missing something?
This is what I am talking about:
Say I created two teams, Red and Blue. Then I created a function for each time, and added a concommand for each. Then, I make a button in a VGUI that when pressed, it runs one of the console commands, which would change the player’s team. I want it so that is the only way to use console commands.
You just have to write some logic to check if the player is still in the menu (player is 64 units from spawn or something).