Raised This Month: $51 Target: $400
 12% 

Hook on CBaseCombatCharcter-Functions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Roger Devil
Senior Member
Join Date: Dec 2004
Location: Germany
Old 03-06-2005 , 06:29   Hook on CBaseCombatCharcter-Functions
Reply With Quote #1

Hi
i have read the threads about hooking virtual functions of any class in the SDK.
Nevertheless i have a small question :
How to hook functions in CBaseComabtCharacter - Class ???
For engine -functions i can directly use IVEngineServer as the entry point,
but what about CBaseCombatCharacter ???
The only way i see is IPlayerInfo, but this is only a member of CBasePlayer.

What I want to do is calculate the damage inflicted to a player and getting the hitboxes, or is there an easier way to get this info ???
Can somebody help me ???
Roger Devil is offline
Send a message via ICQ to Roger Devil
Mani
Veteran Member
Join Date: Dec 2004
Location: UK
Old 03-07-2005 , 05:33  
Reply With Quote #2

XAD knows how to do this, I think his project tracks hit box damage.

Mani
__________________
Installation files, documentation and help can be found at: -

www.mani-admin-plugin.com
Mani is offline
XAD
Senior Member
Join Date: Mar 2004
Location: Sweden
Old 03-07-2005 , 07:02   Re: Hook on CBaseCombatCharcter-Functions
Reply With Quote #3

Quote:
Originally Posted by Mani
XAD knows how to do this, I think his project tracks hit box damage.
Damn you Mani,... pointing finger at me...

Quote:
Originally Posted by Roger Devil
What I want to do is calculate the damage inflicted to a player and getting the hitboxes, or is there an easier way to get this info ???
Can somebody help me ???
Well, you don't have to calculate it... in CSS (for linux) you can get it compensated for both ammo-type, body-part (and distance?)... I hook a couple of functions in a couple of classes and using event-messages and timers... But you get the bodyhits in one functions with damage not fully compensated, and the real damage in another one. Some weapons, such as grenades, do not get the bodyhits info, as bodyhit only exist for "aiming" firearms (at least what I have tracked and logged)...

Unless you understand virtual tables, know how to hook and what happens (as all objects do not share the same vtable but some do), I would use SourceMod...

/X
XAD is offline
Roger Devil
Senior Member
Join Date: Dec 2004
Location: Germany
Old 03-07-2005 , 11:18  
Reply With Quote #4

Hi XAD,
i know what a virtual-function table is, is the table at the first address of the class.
My Problem is how to find out at which position the function OnTakeDamage_Alive() for class CBaseCombatCharacter is, that i can overwrite the address with my own function.
Roger Devil is offline
Send a message via ICQ to Roger Devil
vancelorgin
Senior Member
Join Date: Dec 2004
Location: san frandisco
Old 03-11-2005 , 02:07  
Reply With Quote #5

The lost art of counting works - or, if you're a lazy fuck [read: me], just call the func and put a breakpoint before it, debug the bitch and copy the offset.
__________________
Avoid like the plague.
vancelorgin is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-11-2005 , 07:53  
Reply With Quote #6

If you are compiling on GCC:

Quote:
-fdump-class-hierarchy (C++ only)
-fdump-class-hierarchy-options (C++ only)
Dump a representation of each class's hierarchy and virtual function table layout to a file. The file name is made by appending .class to the source file name. If the -options form is used, options controls the details of the dump as described for the -fdump-tree options.
(http://gcc.gnu.org/onlinedocs/gcc-3....ugging-Options)

Under MSVC, breakpoint/disassembly, as lance said.

I prefer this method over counting, because the compiler may do weird things if it is a derived class ;o
__________________
hello, i am pm
PM is offline
vancelorgin
Senior Member
Join Date: Dec 2004
Location: san frandisco
Old 03-11-2005 , 15:05  
Reply With Quote #7

fuck damn that's handy
__________________
Avoid like the plague.
vancelorgin is offline
fysh
Senior Member
Join Date: Oct 2004
Old 03-11-2005 , 19:54  
Reply With Quote #8

You can also load gdb and type disassemble funcname to get it.
fysh is offline
vancelorgin
Senior Member
Join Date: Dec 2004
Location: san frandisco
Old 03-12-2005 , 19:07  
Reply With Quote #9

Not in windows - you linux people and your symbol info - scoff - envy
__________________
Avoid like the plague.
vancelorgin is offline
Roger Devil
Senior Member
Join Date: Dec 2004
Location: Germany
Old 03-15-2005 , 01:31  
Reply With Quote #10

Thanx for your help, got it working under Windows, under Linux I retrieved Segmentation Fault.

Have to find out whats wrong here
Roger Devil is offline
Send a message via ICQ to Roger Devil
Reply



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


All times are GMT -4. The time now is 03:29.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode