AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   blocking a headshot with ham_takedamage and shield effect (https://forums.alliedmods.net/showthread.php?t=95981)

Owyn 06-29-2009 11:16

blocking a headshot with ham_takedamage and shield effect
 
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:00:34: 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;
                } 



Arkshine 06-29-2009 11:22

Re: blocking a headshot with ham_takedamage and get_user_attacker
 
Try to use the offset m_LastHitGroup (75)

Owyn 06-29-2009 11:27

Re: blocking a headshot with ham_takedamage and get_user_attacker
 
ok but why when condition is (number == 1) action is taken even if number isn't 1 in my case?..

Bugsy 06-29-2009 11:40

Re: blocking a headshot with ham_takedamage and get_user_attacker
 
I would avoid using get_user_attacker, I've had problems with it in the past. Look in my aimbot detector source

SchlumPF* 06-29-2009 11:53

Re: blocking a headshot with ham_takedamage and get_user_attacker
 
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

Owyn 06-29-2009 12:42

Re: blocking a headshot with ham_takedamage and get_user_attacker
 
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 =\

Alka 06-29-2009 15:25

Re: blocking a headshot with ham_takedamage and get_user_attacker
 
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?

Owyn 06-29-2009 15:46

Re: blocking a headshot with ham_takedamage and get_user_attacker
 
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


All times are GMT -4. The time now is 15:27.

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