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 ent, body;
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;
}