Raised This Month: $51 Target: $400
 12% 

Solved Unexpected TraceAttack


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ConorCC
Member
Join Date: Feb 2014
Old 01-10-2021 , 11:35   Unexpected TraceAttack
Reply With Quote #1

TraceAttack deal damage for no reason. (It shouldn't deal any).

I want to show the result video. It is only a few seconds but you will see.

Link: https://drive.google.com/file/d/1tTm...ew?usp=sharing

P1 is me and P2 is my helper.

1. I hit him with "att" command. Working fine. (do nothing) Expected prints.
2. I say start then he hits me with his knife or anything. (do nothing) Expected prints.
3. I hit him again with "att" command. I take the damage from the 2. point and it wasn't expected.

I had a bind to "att" so that's why you can't see I writed to console.

Same results with multiple players. If you traceattack someone. Then anybody else he will receive the first one's damage. Same results with different team members.

As I know the TraceAttack should deal any damage. It's only for the blood and directions. If I use TraceAttack as a CT on a T the result should be the same (with no damage) just with bloods.

Here is the code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_util>

new g_beam_spriteg_log[128];

public 
plugin_init() {

    
register_clcmd("att""cmd_att");

    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage_Post"1)
    
RegisterHam(Ham_TraceAttack"player""fw_TraceAttack_Post"1);
}

public 
plugin_precache() {

    
g_beam_sprite precache_model("sprites/laserbeam.spr")
}

public 
cmd_att(id) {

    new 
Floatorigin[3], Floatview_ofs[3], Floatv_angle[3], Floatdirection[3], Floatend_origin[3];

    
pev(idpev_originorigin);
    
pev(idpev_view_ofsview_ofs);
    
xs_vec_add(originview_ofsorigin);
    
pev(idpev_v_anglev_angle);
    
angle_vector(v_angleANGLEVECTOR_FORWARDv_angle);
    
xs_vec_add_scaled(originv_angle100.0end_origin);

    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BEAMPOINTS);
    
write_coord_f(origin[0]);
    
write_coord_f(origin[1]);
    
write_coord_f(origin[2]);
    
write_coord_f(end_origin[0]);
    
write_coord_f(end_origin[1]);
    
write_coord_f(end_origin[2]);
    
write_short(g_beam_sprite);
    
write_byte(0);
    
write_byte(0);
    
write_byte(10);
    
write_byte(10);
    
write_byte(0);
    
write_byte(255);
    
write_byte(255);
    
write_byte(80);
    
write_byte(170);
    
write_byte(0);
    
message_end();

    new 
trace create_tr2();

    
engfunc(EngFunc_TraceLineoriginend_originDONT_IGNORE_MONSTERSidtrace);

    new 
victim_id get_tr2(traceTR_pHit);

    if ( 
victim_id == -) {

        
victim_id 0
        set_tr2
(traceTR_pHitvictim_id);
    }

    new 
Floatdamage 50.0;

    
formatex(g_logcharsmax(g_log), "CMD ATT! FROM %n TO %n WITH %.2f"idvictim_iddamage);
    
client_print(0print_chatg_log);
    
log_to_file("att.log"g_log);

    
ExecuteHamB(Ham_TraceAttackvictim_ididdamagedirectiontraceDMG_NEVERGIB|DMG_BULLET);
    
free_tr2(trace);
}

public 
fw_TakeDamage_Post(victim_idinflictorattacker_idFloat:damagebits) {

    
formatex(g_logcharsmax(g_log), "TAKE DAMAGE! FROM %n TO %n WITH %.2f"attacker_idvictim_iddamage);
    
client_print(0print_chatg_log);
    
log_to_file("att.log"g_log);

    return 
HAM_IGNORED;


public 
fw_TraceAttack_Post(victim_idattacker_idFloatdamageFloatdirection[3], tracedamagebits) {

    
formatex(g_logcharsmax(g_log), "TRACE ATTACK! FROM %n TO %n WITH %.2f"attacker_idvictim_iddamage);
    
client_print(0print_chatg_log);
    
log_to_file("att.log"g_log);

    return 
HAM_IGNORED;

The server is using this one plugin only so nothing modify the results.

Last edited by ConorCC; 01-11-2021 at 12:38. Reason: Update source
ConorCC is offline
 



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 20:41.


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