Raised This Month: $ Target: $400
 0% 

Quick Question: hitzone from get_user_attacker


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mugwump
Senior Member
Join Date: May 2004
Old 10-09-2007 , 14:18   Quick Question: hitzone from get_user_attacker
Reply With Quote #1

Hey folks, I just wanted to confirm that hitzone #3 as returned from a call to get_user_attacker is the back, is that correct? I cannot seem to find a reference to where those zones are defined, all I see are these:

* 1 - generic
* 2 - head
* 4 - chest
* 8 - stomach
* 16 - left arm
* 32 - right arm
* 64 - left leg
* 128 - right leg */

I can only seem to get a 3 from hitting the back so I hope thats the answer, but any info or confirmation on this would be appreciated.

Thanks,
Mugwump
Mugwump is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 10-09-2007 , 14:28   Re: Quick Question: hitzone from get_user_attacker
Reply With Quote #2

3 isn't a bit flag though ..

That would be 2 and 1. A head and generic hit.

The back isn't a hitzone, sadly, you so far as I know you have to calculate that for yourself.
purple_pixie is offline
Mugwump
Senior Member
Join Date: May 2004
Old 10-09-2007 , 14:33   Re: Quick Question: hitzone from get_user_attacker
Reply With Quote #3

Argh, thats not what I was hoping to hear but it makes sense...

Does anyone know of examples that determine if the back is hit? Is there even enough info? My guess would be if I could calculate the direction vector for both myself and my target I could figure that out as we'd both ned to be facing close to the same direction...

Thanks,
Mugwump
Mugwump is offline
fxfighter
Veteran Member
Join Date: Feb 2007
Location: Trollhättan
Old 10-09-2007 , 14:58   Re: Quick Question: hitzone from get_user_attacker
Reply With Quote #4

sry but i wont give you an answer but i think you are trying to do stuf when someone got hit somewhare or something so i post this pice of code and i think you know what to do use dmg event instead.
dont think this works on back-.- like purple pixie sayd
PHP Code:
public Death( ) 
{
 new 
iVictim read_data)
 new 
weaponhitplaceattacker get_user_attacker(iVictim,weapon,hitplace)
if(
hitplace == HIT_CHEST)
 { 
 }
 if(
hitplace == HIT_HEAD)
 {
 }
 if(
hitplace == HIT_RIGHTARM)
 {
 }
 if(
weapon == CSW_KNIFE)
 {
 }

__________________
If one of my plugins become broken, contact me by mail. [email protected]

Last edited by fxfighter; 10-09-2007 at 15:02.
fxfighter is offline
Send a message via MSN to fxfighter
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-09-2007 , 15:03   Re: Quick Question: hitzone from get_user_attacker
Reply With Quote #5

If you knifed someone in the back, how does HL know its a backstab? Maybe by the way the 2 players were oriented in relation to eachother?
__________________
M249-M4A1 is offline
Mugwump
Senior Member
Join Date: May 2004
Old 10-09-2007 , 15:15   Re: Quick Question: hitzone from get_user_attacker
Reply With Quote #6

I think I have a reasonable guess...

1. Calculate the direction angles for myself
2. Calculate the direction angles for my target
3. We should roughly be facing the same direction (maybe within +-45 in x and y)


Code:
   new Float:angles[3],tangles[3]
   pev( myid, pev_angles, angles )   
   pev( targid, pev_angles, tangles )
   
   if ( ( floatabs(angles[0] - tangles[0]) < 45 ) && ( floatabs(angles[1] - tangles[1]) < 45 ) ){
      // Back hit
   }
Does that look right?

-Mugwump
Mugwump is offline
Mugwump
Senior Member
Join Date: May 2004
Old 10-09-2007 , 16:09   Re: Quick Question: hitzone from get_user_attacker
Reply With Quote #7

I have confirmed in game that this is as good an approximation as I'd want to determine the success of landing a backstab, etc ...

Thanks for the help folks.

-K2/Mugwump
Mugwump is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-09-2007 , 16:30   Re: Quick Question: hitzone from get_user_attacker
Reply With Quote #8

Congrats, and this would be a good guide for those who want to find out how to look for back-attacks too
__________________
M249-M4A1 is offline
Reply


Thread Tools
Display Modes

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 16:12.


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