AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Accurate bullet decals? (https://forums.alliedmods.net/showthread.php?t=307453)

sekac 05-10-2018 15:12

Accurate bullet decals?
 
I have tried editing this code to show the bullet decals where the bullet lands. Right now the bullet decals don't go where my crosshair is. I thought that decals displayed correctly server side, but I was wrong (I used cl_lw 0 to test that).

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>

public plugin_init() {
    
register_plugin("i aim good","0.11","Avalanche");
    
register_forward(FM_TraceLine,"fw_traceline");
}

public 
fw_traceline(Float:v1[3],Float:v2[3],noMonsters,id) {
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED;
    
    
// get crosshair aim
    
new MyAim[3], Float:flMyAim[3];
    
get_user_origin(id,MyAim,3);
    
IVecFVec(MyAim,flMyAim);
    
    
// set crosshair aim
    
set_tr(TR_vecEndPos,flMyAim);
    
    
// get ent looking at
    
new entbody;
    
get_user_aiming(id,ent,body);
    
    
// if looking at something
    
if(is_valid_ent(ent)) {
        
set_tr(TR_flFraction,0.1); // 1.0 == no hit, < 1.0 == hit
        
set_tr(TR_pHit,ent); // entity hit
        
set_tr(TR_iHitgroup,body); // bodypart hit
    
}
    
    return 
FMRES_IGNORED;




All times are GMT -4. The time now is 04:38.

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