So, basically what I'm doing is a lasermine. Based in lasermine angle, I will create a velocity vector by the mine aim (velocity_by_aim) and get the end origin in a distance of 9999. After some tests, I see that when I do this while the mine is placed in wall, it work, but if it is in the ground or in "roof" get the inverse direction than I want. Then if it is on the ground, laser will be generated in ground direction, if in roof, laser will be generated in roof direction. I hope you understand, but this was solved.
Code:
new Float:flVecStart[3], Float:flVecEnd[3], Float:flVecPlane[3], Float:flFraction;
entity_get_vector(pPlayer, EV_VEC_origin, flVecStart);
getAimOrigin(pPlayer, 65, flVecEnd);
engfunc(EngFunc_TraceLine, flVecStart, flVecEnd, DONT_IGNORE_MONSTERS, pPlayer, 0);
get_tr2(0, TR_flFraction, flFraction);
new pHit = max(get_tr2(0, TR_pHit), 0);
if (flFraction == 1.0 || pHit)
{
zp_colored_print(pPlayer, "You can't set a lasermine at this location.");
return;
}
get_tr2(0, TR_vecEndPos, flVecEnd);
get_tr2(0, TR_vecPlaneNormal, flVecPlane);
vectorMulScalar(flVecPlane, 8.0, flVecPlane);
// The mine origin
vectorAdd(flVecEnd, flVecPlane, g_flVecAim[pPlayer]);
// The mine angles
vector_to_angle(flVecPlane, g_flVecAngles[pPlayer]);
// The mine laser end point
vectorMulScalar(flVecPlane, 9999.0, flVecPlane);
vectorAdd(g_flVecAim[pPlayer], flVecPlane, g_flVecEnd[pPlayer]);
__________________