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

damage listening event...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Graaf
Junior Member
Join Date: Jan 2005
Old 01-24-2005 , 17:56   damage listening event...
Reply With Quote #1

IS it possible to check what kind of damage is done to a player?!

Like 15 damage on the left arm, and 20 damage on the right leg.
And after a while 120 damage on the head, what will result in player death with headshot.
__________________
Vette Shit!
Graaf is offline
tahvo
Member
Join Date: Sep 2004
Old 01-24-2005 , 18:06  
Reply With Quote #2

You need plugin for that and I think nobody has not published that kind of plugin.
tahvo is offline
XAD
Senior Member
Join Date: Mar 2004
Location: Sweden
Old 01-24-2005 , 19:34   Re: damage listening event...
Reply With Quote #3

Quote:
Originally Posted by Graaf
IS it possible to check what kind of damage is done to a player?!

Like 15 damage on the left arm, and 20 damage on the right leg.
And after a while 120 damage on the head, what will result in player death with headshot.
OK, you need to understand the system first... and then decide what you actually want to do...

You can get the proper info but it requires you to use the CSS internal classes, which doesn't have to look as the ones in the SDK (using anything else than official API will make your implementation more vulnerable to be non-working after an update). To do this you "only" have to browse through the source code example in the SDK...

This has always been true BUT people would then say it worked with CS 1.6 (AMXmod, AMXmodX, StatsMe)... well NONE of them logged where you hit!!! What they did was tracking where you aimed (using the trace function and saved the hitbox you aimed at). Then when a hit occured (regular trapping of events) they checked where the attacker last aimed at... Now this works pretty OK but as you know you are often not hitting where you aim so it won't be correct. This is also why you could have a headshot kill but not a headshot hit (HS-kill is sent in the message when you die so it's accurate).

If you want correct logging then you need to o the hard and vulnurable path or you take the pretty OK one and then you can use standard API's...

GL & HF
/X
XAD is offline
vancelorgin
Senior Member
Join Date: Dec 2004
Location: san frandisco
Old 01-24-2005 , 20:22  
Reply With Quote #4

Just read int CBaseCombatCharacter::m_LastHitGroup. BaseCombatCharacter.cpp line ~500,

#define HITGROUP_GENERIC 0
#define HITGROUP_HEAD 1
#define HITGROUP_CHEST 2
#define HITGROUP_STOMACH 3
#define HITGROUP_LEFTARM 4
#define HITGROUP_RIGHTARM 5
#define HITGROUP_LEFTLEG 6
#define HITGROUP_RIGHTLEG 7
#define HITGROUP_GEAR 10 // alerts NPC, but doesn't do damage or bleed (1/100th damage)
__________________
Avoid like the plague.
vancelorgin is offline
XAD
Senior Member
Join Date: Mar 2004
Location: Sweden
Old 01-25-2005 , 02:53  
Reply With Quote #5

Quote:
Originally Posted by vancelorgin
Just read int CBaseCombatCharacter::m_LastHitGroup. BaseCombatCharacter.cpp line ~500,
Well that var is "private" and the LastHitGroup is "protected". Also why do more than you need with checking events, resolve them, hack into the private and protected functions when you can hook public virtual functions that will only be called when needed and with all data you need (still hack but less and cleaner code)...

/X
XAD is offline
Graaf
Junior Member
Join Date: Jan 2005
Old 01-25-2005 , 04:16  
Reply With Quote #6

It just looks like there's no-one out there working with the hl2sdk that want's to log damage and hitting information ?!
__________________
Vette Shit!
Graaf is offline
vancelorgin
Senior Member
Join Date: Dec 2004
Location: san frandisco
Old 01-25-2005 , 12:44  
Reply With Quote #7

Quote:
Originally Posted by XAD
Well that var is "private" and the LastHitGroup is "protected".
So make them public.. :s Nothing is really private or protected

Quote:
Also why do more than you need with checking events, resolve them, hack into the private and protected functions when you can hook public virtual functions that will only be called when needed and with all data you need (still hack but less and cleaner code)...
Yeah, that'd give you more power, but accessing a class member is far far far far less hackish and alot easier than hooking a virtual method. I revere hackish stuff, myself, but others may not
__________________
Avoid like the plague.
vancelorgin is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 01-25-2005 , 15:03  
Reply With Quote #8

vancel do you think it would be possible w/a memory hack or something to catch the damage done before the engine processes it? Basically being able to change it first?
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Graaf
Junior Member
Join Date: Jan 2005
Old 01-25-2005 , 15:23  
Reply With Quote #9

Ah well .. I'll just wait untill someone creates an server plugin with damage logging
I've been looking at it .. and can't figure out how to create a simple damage logging.
__________________
Vette Shit!
Graaf is offline
vancelorgin
Senior Member
Join Date: Dec 2004
Location: san frandisco
Old 01-25-2005 , 15:58  
Reply With Quote #10

Easily - hook these funcs as you see fit on CBaseCombatCharacter / CBasePlayer:

Code:
	virtual int				OnTakeDamage( const CTakeDamageInfo &info );

	// Override these to control how your character takes damage in different states
	virtual int				OnTakeDamage_Alive( const CTakeDamageInfo &info );
	virtual int				OnTakeDamage_Dying( const CTakeDamageInfo &info );
	virtual int				OnTakeDamage_Dead( const CTakeDamageInfo &info );
Change info as you see fit - it's the full damage container including type, originating entity, numeric value, reported position, etc etc.
__________________
Avoid like the plague.
vancelorgin is offline
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 15:01.


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