AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_TraceAttack would call twice when TR_pHit's classname is "func_door"? (https://forums.alliedmods.net/showthread.php?t=216368)

a7811311622 05-20-2013 05:35

Ham_TraceAttack would call twice when TR_pHit's classname is "func_door"?
 
1 Attachment(s)
As shown in figure : cstrike 2013-05-20 17-09-39-578.jpg
TraceLine would call once in "func_door" but TraceAttack would call twice.
Does anybody know why?

ConnorMcLeod 05-20-2013 06:58

Re: Ham_TraceAttack would call twice when TR_pHit's classname is "func_door"?
 
Depending on weapons, 1 (guns excepted deagle, smgs), 2 (deagle, riffles), or 3 (awp, m249??) traces are proceeded on each shot.
So TraceLine is fired that amount of time, and TraceAttack is fired on the hit entity, so could be different ents.

Of, if you really shot with glock, non burst, then show your code, seems that you've made some mistake, and make sure you test with no other plugins loaded.

a7811311622 05-20-2013 09:13

Re: Ham_TraceAttack would call twice when TR_pHit's classname is "func_door"?
 
Quote:

Originally Posted by ConnorMcLeod (Post 1954983)
Depending on weapons, 1 (guns excepted deagle, smgs), 2 (deagle, riffles), or 3 (awp, m249??) traces are proceeded on each shot.
So TraceLine is fired that amount of time, and TraceAttack is fired on the hit entity, so could be different ents.

Of, if you really shot with glock, non burst, then show your code, seems that you've made some mistake, and make sure you test with no other plugins loaded.

I shot with glock, non burst.
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new const g_objective_ents[][] = { "func_bomb_target""func_breakable""func_button""func_buyzone""func_conveyor""func_door",
    
"func_door_rotating""func_escapezone""func_friction""func_grencatch""func_guntarget""func_healthcharger""func_hostage_rescue",
    
"func_illusionary""func_ladder""func_monsterclip""func_mortar_field""func_pendulum""func_plat""func_platrot""func_pushable",
    
"func_rain""func_recharge""func_rot_button""func_rotating""func_snow""func_tank""func_tankcontrols""func_tanklaser",
    
"func_tankmortar""func_tankrocket""func_trackautochange""func_trackchange""func_tracktrain""func_train""func_traincontrols",
    
"func_vehicle""func_vehiclecontrols""func_vip_safetyzone""func_wall""func_wall_toggle""func_water""func_weaponcheck" }

public 
plugin_init()
{
    
register_plugin("undefined""1.0""undefined")
    
    for (new 
0sizeof g_objective_entsi++)
    {
        
RegisterHam(Ham_TraceAttackg_objective_ents[i], "fw_TraceAttack_Post"1)
    }
    
    
RegisterHam(Ham_TraceAttack"player""fw_TraceAttack_Post"1)
    
RegisterHam(Ham_TraceAttack"worldspawn""fw_TraceAttack_Post"1)
}


public 
fw_TraceAttack_Post(victimattackerFloat:damageFloat:direction[3], tracehandledamage_type)
{
    
client_print(0print_chat"victim[%d]attacker[%d]damage[%f]direction[%.3f,%.3f,%.3f]tracehandle[%d]Hitgroup[%d]"victimattackerdamagedirection[0], direction[1], direction[2], tracehandleget_tr2(tracehandleTR_iHitgroup))


If i use this code, Ham_TraceAttack just calls once.
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

public plugin_init()
{
    
register_plugin("undefined""1.0""undefined")
    
    
RegisterHam(Ham_TraceAttack"func_door""fw_TraceAttack_Post"1)
}


public 
fw_TraceAttack_Post(victimattackerFloat:damageFloat:direction[3], tracehandledamage_type)
{
    
client_print(0print_chat"victim[%d]attacker[%d]damage[%f]direction[%.3f,%.3f,%.3f]tracehandle[%d]Hitgroup[%d]"victimattackerdamagedirection[0], direction[1], direction[2], tracehandleget_tr2(tracehandleTR_iHitgroup))


I guess that func_door is the same as other func_XXX ?

ConnorMcLeod 05-20-2013 13:31

Re: Ham_TraceAttack would call twice when TR_pHit's classname is "func_door"?
 
Yes, func_water is same as func_door, you can filter it with properties, may be some other func_, so use classname.

a7811311622 05-21-2013 07:17

Re: Ham_TraceAttack would call twice when TR_pHit's classname is "func_door"?
 
Quote:

Originally Posted by ConnorMcLeod (Post 1955172)
Yes, func_water is same as func_door, you can filter it with properties, may be some other func_, so use classname.

I understand, thank you.


All times are GMT -4. The time now is 16:23.

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