Raised This Month: $ Target: $400
 0% 

blocking a headshot with ham_takedamage and shield effect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Owyn
Veteran Member
Join Date: Nov 2007
Old 06-29-2009 , 11:16   blocking a headshot with ham_takedamage and shield effect
Reply With Quote #1

hi, i'm trying to block a headshoot, hitzone was checked with traceline and it worked not bad but people still got headshoted and killed with hs =\
now i check hitzone with get_user_attacker(), but i'm getting weird logs where none of hitzones are head but still logged =\ :

Quote:
L 06/29/2009 - 19:00:12: iWep: 26, HitZone = 3, TL hitZone: 4, dmg: 46.000000

L 06/29/2009 - 19:004: iWep: 22, HitZone = 7, TL hitZone: 7, dmg: 23.250000

L 06/29/2009 - 19:01:17: iWep: 29, HitZone = 3, TL hitZone: 2, dmg: 52.000000

L 06/29/2009 - 19:07:15: iWep: 26, HitZone = 3, TL hitZone: 3, dmg: 51.250000

L 06/29/2009 - 19:07:17: iWep: 22, HitZone = 4, TL hitZone: 7, dmg: 26.250000

L 06/29/2009 - 19:07:17: iWep: 28, HitZone = 6, TL hitZone: 7, dmg: 23.250000

L 06/29/2009 - 19:07:22: iWep: 22, HitZone = 3, TL hitZone: 2, dmg: 28.000000

L 06/29/2009 - 19:07:24: iWep: 16, HitZone = 5, TL hitZone: 5, dmg: 26.000000
PHP Code:
public plugin_init()
{
register_forwardFM_TraceLine        "TRIGGER_TraceLine"    );
RegisterHam(Ham_TakeDamage"player""EVENT_TakeDamage");
}

new 
UserHit[33];
public 
TRIGGER_TraceLineFloat:v1[3], Float:v2[3], noMonsterspentToSkip )
{
    new 
iAttacker pentToSkip;
    new 
iVictim get_tr(TR_pHit);
    new 
iHitZone get_tr(TR_iHitgroup);
    
UserHit[iVictim] = iHitZone
}
public 
EVENT_TakeDamageiVictiminflictoriAttackerFloat:iDamageedamagetype )
{
    static 
iHitPlaceiWeapon
    get_user_attacker
iVictim iWeapon iHitPlace )

                if( 
iHitPlace HIT_HEAD || UserHit[iVictim] & HIT_HEAD )
                {    
                        
log_to_file("headshots_blocked.txt","    iWep: %d, HitZone = %d, TL hitZone: %d, dmg: %f^n" ,iWeaponiHitPlaceUserHit[iVictim],iDamagee);

                        return 
HAM_SUPERCEDE;
                } 

__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.

Last edited by Owyn; 06-29-2009 at 11:19.
Owyn is offline
Send a message via ICQ to Owyn
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-29-2009 , 11:22   Re: blocking a headshot with ham_takedamage and get_user_attacker
Reply With Quote #2

Try to use the offset m_LastHitGroup (75)
__________________
Arkshine is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 06-29-2009 , 11:27   Re: blocking a headshot with ham_takedamage and get_user_attacker
Reply With Quote #3

ok but why when condition is (number == 1) action is taken even if number isn't 1 in my case?..
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-29-2009 , 11:40   Re: blocking a headshot with ham_takedamage and get_user_attacker
Reply With Quote #4

I would avoid using get_user_attacker, I've had problems with it in the past. Look in my aimbot detector source
__________________
Bugsy is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 06-29-2009 , 11:53   Re: blocking a headshot with ham_takedamage and get_user_attacker
Reply With Quote #5

try this (headshot is changed into a chest hit) if you dont plan to use it with bots:

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

public plugin_init( )
{
    
register_plugin"I""like""Ice Creame" );
    
RegisterHamHam_TraceAttack"player""hamTraceAttackPlayer_Pre");
}

public 
hamTraceAttackPlayer_PrevictimattackerFloat:damageFloat:direction[3], trdamagebits )
{
    if( 
get_tr2trTR_iHitgroup ) == HIT_HEAD )
    {
        
set_tr2trTR_iHitgroupHIT_CHEST );
    }

mh i guess you should change my code to set TR_vecEndPos so the correct origin for the blood is set too ;D
if you plan to use bots look at this tutorial: http://forums.alliedmods.net/showthr...ighlight=trace
__________________

Last edited by SchlumPF*; 06-29-2009 at 12:35.
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
Owyn
Veteran Member
Join Date: Nov 2007
Old 06-29-2009 , 12:42   Re: blocking a headshot with ham_takedamage and get_user_attacker
Reply With Quote #6

why can't i set hitzone to shield ( 8 ) in traceattack but only in traceline? in traceattack it spawns blood and no shield effect at all =\
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 06-29-2009 , 15:25   Re: blocking a headshot with ham_takedamage and get_user_attacker
Reply With Quote #7

L0L .Owyn. , dunno but why you asking here -> http://forums.alliedmods.net/showthread.php?t=95992 how to detect shield hit if you know HitGroup for shield?
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 06-29-2009 , 15:46   Re: blocking a headshot with ham_takedamage and get_user_attacker
Reply With Quote #8

i know how to detect when user is aiming at the shield but not hitting it, i should have described it there better.

the thing is i set hitzone to shield instead of head in traceline but i need to count hits made to victim this way, i don't want where one player just stare at another one and hits becomes bigger constantly (what i got), sure i could emulate shield sound and disable blood from traceattack ( TR_vecEndPos ? ) but still have no idea how to make sparks ( maybe i should ask about sparks? ) just thought there is something i can do just to get shield hit after traceline
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
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:27.


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