Player attacked from behind?
Is there any possibility to check if enemy was attacked from behind?
How can I possibly check if player was visible or something like this ;d. Tried that way: http://forums.alliedmods.net/showthr...player+visible But it's too hard for me to do. If there was any library to include with that function I'd be happy. Anyone knows anything bout that? |
Re: Player attacked from behind?
Ham_TraceAttack gives you the vector from which the player was attacked.
|
Re: Player attacked from behind?
As Liverwiz stated, you have a directional vector of the attack.
You can also get the direction that the victim is aiming. With those 2 vectors, you can use xs_vec_angle() to see the angle between the attack and the aim. I would say if the resulting angle is less than 45 degrees, then player was attacked from behind. |
Re: Player attacked from behind?
Yah, I realized that while ago ;D.
Thanks for help anyway. PHP Code:
|
Re: Player attacked from behind?
Quote:
If you don't use the method I described, then you have to do a bunch of checks for that math to work. |
Re: Player attacked from behind?
PHP Code:
|
Re: Player attacked from behind?
new Float:AngleA[3], Float:AngleV[3]
PHP Code:
|
Re: Player attacked from behind?
Well that's actually same way as I did. I just changed form (-180,180) to (0,360) firstly to make it more clear to me.
|
Re: Player attacked from behind?
Code:
EDIT: Or if you must... Code:
|
Re: Player attacked from behind?
Thanks, but Can you say what is wrong in my second try? :)
|
| All times are GMT -4. The time now is 05:49. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.