AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   TraceAttack & TakeDamage weapons overpass teammates (https://forums.alliedmods.net/showthread.php?t=298687)

baneado 06-20-2017 11:47

TraceAttack & TakeDamage weapons overpass teammates
 
Making tests, I see some weapons can't take damage to the enemy if you have a teammate between him and you.

But others yees. Why is happening this? Any way to change (or fix) this?

List of weapons can overpass teammate:
  • deagle
  • galil, famas
  • ak47, m4a1
  • sg552, aug
  • g3sg1, sg550
  • awp
  • scout? (not tested)

Weapons not in the list can't overpass teammate. The bullet disappear on him

Natsheh 06-20-2017 11:59

Re: TraceAttack & TakeDamage weapons overpass teammates
 
I guess these weapons that can pass are also breaks through the walls... These wpns has ahigh traceattacks

baneado 06-20-2017 13:23

Re: TraceAttack & TakeDamage weapons overpass teammates
 
Yes, it's true.

But I'm asking to solve the problem. It's really a headache on a server with semiclip.

PRoSToTeM@ 06-20-2017 13:43

Re: TraceAttack & TakeDamage weapons overpass teammates
 
Make your teammates non-solid before the attack and restore solid after the attack.

baneado 06-21-2017 11:41

Re: TraceAttack & TakeDamage weapons overpass teammates
 
Quote:

Originally Posted by PRoSToTeM@ (Post 2530125)
Make your teammates non-solid before the attack and restore solid after the attack.

Ok, working

But where to restore solid? I tried TraceAttack_Post, FM_PlayerPostThink, but seems to be soon to restore solid and bullet doesn't overpass teammate.

My test plugin:
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>

new bool:HasSemiclip[33]

const 
WEAPONS_TO_FIX = (1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_MP5NAVY)|(1<<CSW_M3)|(1<<CSW_TMP)|(1<<CSW_P90)

public 
plugin_init()
{
    
register_forwardFM_PlayerPostThink"fwdPlayerPostThink" )
    
    
RegisterHam(Ham_TraceAttack"player""fw_TraceAttack_Pre")
    
//RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack_Post", 1)
}

public 
fwdPlayerPostThinkid )
{
    if( 
HasSemiclip[id] )
    {
        
entity_set_intidEV_INT_solidSOLID_SLIDEBOX )
        
HasSemiclip[id] = false
        client_print
(0print_chat"Debug solid final")
    }
}

public 
fw_TraceAttack_Pre(victimattackerFloat:DamageFloat:fDir[3], ptriDamageType)
{
    if (!
is_user_connected(attacker)) // not player
        
return HAM_IGNORED;
        
    if (
cs_get_user_team(attacker) != cs_get_user_team(victim))
    {
        
client_print(0print_chat"Debug team")
        return 
HAM_IGNORED;
    }
        
    if (!((
1<<get_user_weapon(attacker)) & WEAPONS_TO_FIX))
    {
        
client_print(0print_chat"Debug weapon")
        return 
HAM_IGNORED;
    }
    
    
client_print(0print_chat"Debug solid")
    
entity_set_int(victimEV_INT_solidSOLID_NOT)
    
HasSemiclip[victim] = true
    
return HAM_HANDLED;
}

public 
fw_TraceAttack_Post(victimattackerFloat:DamageFloat:fDir[3], ptriDamageType)
{
    if (!
is_user_connected(attacker)) // not player
        
return HAM_IGNORED;
        
    
entity_set_int(victimEV_INT_solidSOLID_SLIDEBOX)
    return 
HAM_HANDLED;



edon1337 06-21-2017 12:27

Re: TraceAttack & TakeDamage weapons overpass teammates
 
Set a 0.1 second delay on TraceAttack post and test.

baneado 06-21-2017 13:14

Re: TraceAttack & TakeDamage weapons overpass teammates
 
Quote:

Originally Posted by edon1337 (Post 2530397)
Set a 0.1 second delay on TraceAttack post and test.

How? set_task isn't a good idea. An entity thinking would be worse here
Quote:

Originally Posted by Natsheh (Post 2530406)
Here try this..
PHP Code:

#include <amxmodx> 
#include <cstrike> 
#include <engine>
#include <hamsandwich> 

new user_oldsolid[33]

const 
WEAPONS_TO_FIX = (1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_MP5NAVY)|(1<<CSW_M3)|(1<<CSW_TMP)|(1<<CSW_P90

public 
plugin_init() 
{
    
RegisterHam(Ham_TraceAttack"player""fw_TraceAttack_Pre"
    
RegisterHam(Ham_TraceAttack"player""fw_TraceAttack_Post"1


public 
fw_TraceAttack_Pre(victimattackerFloat:DamageFloat:fDir[3], ptriDamageType

    if (!
attacker// not player 
        
return HAM_IGNORED
         
    if (
cs_get_user_team(attacker) != cs_get_user_team(victim)) 
    { 
        return 
HAM_IGNORED
    } 
         
    if (!((
1<<get_user_weapon(attacker)) & WEAPONS_TO_FIX)) 
    { 
        return 
HAM_IGNORED
    } 
     
user_oldsolid[victim] = entity_get_int(victimEV_INT_solid);
    
entity_set_int(victimEV_INT_solidSOLID_NOT )
    return 
HAM_IGNORED


public 
fw_TraceAttack_Post(victimattackerFloat:DamageFloat:fDir[3], ptriDamageType

    if (!
attacker// not player 
        
return HAM_IGNORED
        
    if (
cs_get_user_team(attacker) != cs_get_user_team(victim)) 
    { 
        return 
HAM_IGNORED
    } 
   if (!((
1<<get_user_weapon(attacker)) & WEAPONS_TO_FIX)) 
    { 
        return 
HAM_IGNORED
    } 
    
entity_set_int(victimEV_INT_solid,  user_oldsolid[victim] )
    return 
HAM_IGNORED



It's the same...

PRoSToTeM@ 06-21-2017 13:48

Re: TraceAttack & TakeDamage weapons overpass teammates
 
Quote:

Originally Posted by baneado (Post 2530377)
But where to restore solid? I tried TraceAttack_Post, FM_PlayerPostThink, but seems to be soon to restore solid and bullet doesn't overpass teammate.

Just use Ham_Weapon_PrimaryAttack with Pre and Post hooks.

baneado 06-22-2017 10:56

Re: TraceAttack & TakeDamage weapons overpass teammates
 
Quote:

Originally Posted by PRoSToTeM@ (Post 2530426)
Just use Ham_Weapon_PrimaryAttack with Pre and Post hooks.

That's the final solution. Working great :)

I'm using get_user_aiming on Pre, any other way?

PRoSToTeM@ 06-22-2017 13:09

Re: TraceAttack & TakeDamage weapons overpass teammates
 
Quote:

Originally Posted by baneado (Post 2530690)
I'm using get_user_aiming on Pre, any other way?

get_user_aiming can hit only 1 teammate, the other way is to make all your teammates non-solid (via get_players and for loop).


All times are GMT -4. The time now is 22:59.

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