.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > YappA > Half-Life 2, Source and Source Games
Half-Life 2, Source and Source Games Discuss about Valve's new FPS game and its mods here Half-Life 2

Reply
 
Thread Tools
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 17:22..
  
Reply With Quote
Re: Reply "hlcoder": fake client command
Old
  (#2)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Reply "hlcoder": fake client command - 14-01-2005

it was my e-mail on the hlcoders list. But i am not sure what you're talking about.

Afaik you cannot process client commands on fake clients with HL2 because they are ignored by the engine. So somehow we need to do it the hard way and pass it via the Cmd_<> functions.


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Reply "hlcoder": fake client command
Old
  (#3)
biohazerd87
Moderator by day Waypointer by night
 
biohazerd87's Avatar
 
Status: Offline
Posts: 1,039
Join Date: Apr 2004
Location: Missouri
Default Re: Reply "hlcoder": fake client command - 14-01-2005

lets not start a war, i know how coders get when they haven't slept in 3 days working on code only to get an error containing numbers and letters that acutally ends up looking like a word only in leet speek ???
  
Reply With Quote
Re: Reply "hlcoder": fake client command
Old
  (#4)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Reply "hlcoder": fake client command - 14-01-2005

War? whatfor? I just don't get it


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Reply "hlcoder": fake client command
Old
  (#5)
XAD
Member
 
Status: Offline
Posts: 4
Join Date: Jan 2005
Default Re: Reply "hlcoder": fake client command - 14-01-2005

Quote:
Originally Posted by stefanhendriks
it was my e-mail on the hlcoders list.
I know, I just didn't wanted to point you out...

Quote:
Originally Posted by stefanhendriks
Afaik you cannot process client commands on fake clients with HL2 because they are ignored by the engine. So somehow we need to do it the hard way and pass it via the Cmd_<> functions.
First please read (again?) as that isn't what I wrote, secondly to make a hook on any command in the exposed interfaces is easy and safe, wich I also wrote. (On linux it's two lines if you know the function number.)

I do agree you have to hook the engine's Cmd_<> functions, but I said that the game.dll ClientCommand is not enough to call as it is called by the engine for only a few commands (such as joingame, jointeam, ...). You have to call the registered ConCommand's callback (as I described) to execute the correct functions. Remember that ClientCommand exist in both the game.dll and engine interface (and I talked about the game.dll)...

There are though some limitations as some commands are client side only and some are different on the server and the client (such as kick and disconnect)... Also some "commands" are handled through the ProcessUsercmds (such as weapons)...

One solution to fix disconnect could be to also hook the dicsonnect ConCommand and if command index is not the console, then run the server "kick" command on the player/bot. With HPB-bot2, kick with name works but not kickid. Probably related to the autokick bug in the CSmod that still uses the old "kick" instead of "kickid". (So what I did to fix the autokick bug I made a hook on kick and then re-issuing the server command with "kickid" instead.)

As you asked for help and seam to have some good reputation on this site I thought I would share my findings with you... as I have "hurtme" and "say" working for me with both HPB-bot2 and real clients. "hurtme" also kills the players/bots correctly when health is 0 or negative.

If you ask for help, at least you should read the responses...

Well, god luck... over and out, and gone...
/X
  
Reply With Quote
Re: Reply "hlcoder": fake client command
Old
  (#6)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Reply "hlcoder": fake client command - 14-01-2005

Quote:
If you ask for help, at least you should read the responses...
Sorry if my reply was some kind of 'vague' or looked like i did not read ur post, that is not the intention, though i do not always read them extensively when i see something i think thats not possible from the start (bad habbit, i know).

When i read the con command stuff, i think it makes sense. But i wonder how we can figure out any specific CSS con commands then. I don't have the source of CSS

Besides that i wonder what we really need. So far i think you can buy stuff with "buy <weapon name>" (which i saw in some buy scripts and forums). And to select a weapon, i think you can even just fill in the weapon name. Apart from all other stuff i don't need any "con command".

I'll try to get this stuff working, that will be in the week of 24th of january that i may code again... got somewhat 'punished' by parents for not spending time correctly past days heh


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Reply "hlcoder": fake client command
Old
  (#7)
XAD
Member
 
Status: Offline
Posts: 4
Join Date: Jan 2005
Default Re: Reply "hlcoder": fake client command - 15-01-2005

FYI: "kill" (used to "slay"), "hurtme" (used to "slap"), "buy", "drop" also tested and works... but "use" is not sent as a ConCommand or ClientCommand so it has to be done differently (both for real players and bots)...

/X

PS! ConCommand can be listed in console or loop through the ConCommandBase list (also using a hexeditor in the binary files are very usefull)...

**Edit** What I'm doing is first to check the ConCommand list and if no match is found then I call game.dll's ClientCommand... both wrapped with code to tokenize the command and redirect the engine's Cmd_<> functions to use the new string instead of engine's token...

Last edited by XAD; 15-01-2005 at 16:07..
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com