View Single Post
Reply "hlcoder": fake client command
Old
  (#1)
XAD
Member
 
Status: Offline
Posts: 4
Join Date: Jan 2005
Default Reply "hlcoder": fake client command - 14-01-2005

A question on the hlcoders list (from someone in this forum):
Quote:
Probably something very tricky, but here goes:
...
In HL1 there was a possibility to hook up:
Cmd_Args (void);
Cmd_Argv (int argc);
Cmd_Argc (void);
No the "hooking" is pretty simple... save and "override" the virtual function in the engine interface to call your "meta" routine... in the meta routine, do your stuff and optionally call the original function...

BUT! you won't be able to do much with it... a lot of client commands are never sent through this function... If you display the calls to the plugin's clientcommand you will find out that there are pretty few orignal commands sent this way (I already tested this as I had the same idea as you)...

What you need to do (that's obvious if you think, which I didn't do first) is to use the console command process for most commands. Either you use the manager or (which I tested) loop through the cvar/command list to find the proper command, call the servergameclients SetCommandClient, and then execute the commands dispatch function. Of course you need to "hook" the engines Cmd_Argc, Args, and Argv to replace the original command strings to your specified. (Just make sure you use an indicator to make sure the result from the cmd_arg functions are only replaced during the "faked" call to the dispatch function.)

This method only uses "hooks" on public engine interfaces or interfaces used by the engine which should make it pretty stable (as changes to these would make HLDS-mods incompatible and therefore would crash server with automated steam updates).

/X

Last edited by XAD; 14-01-2005 at 16:22..
  
Reply With Quote