I apologize in advance for the spaghetti code but I really couldn't think of any other way to accomplish your goal... I created a duplicate entity, made it invisible, and made the attach_view follow that entity instead, so I inverted the yaw for the real entity and kept it the same for the invisible one...
PHP Code:
#include AMXMODX
#include ENGINE
new bool:g_bInvertYaw;
public plugin_init()
{
register_clcmd("__weapon__", "__give_weapon__");
register_clcmd("invert_angle", "invert_angle");
}
public invert_angle() g_bInvertYaw = !g_bInvertYaw;
public __give_weapon__(const iPlayer)
{
// It's only for testing purpose; code can be improved a lot, I know :)...
new Float:fCoords[3];
entity_get_vector(iPlayer, EV_VEC_origin, fCoords);
fCoords[2] += 35.0;
new iWeapon = create_entity("info_target");
{
entity_set_origin(iWeapon, fCoords);
entity_set_model(iWeapon, "models/v_ak47.mdl");
entity_set_string(iWeapon, EV_SZ_classname, "__custom_weapon__");
entity_set_edict(iWeapon, EV_ENT_owner, iPlayer);
entity_set_float(iWeapon, EV_FL_nextthink, 0.001);
set_rendering(iWeapon, kRenderFxGlowShell, 255, 0, 255, kRenderNormal, 5);
register_think("__custom_weapon__", "__think_custom_weapon__");
new iWeapon2 = create_entity("info_target")
entity_set_model(iWeapon2, "models/v_ak47.mdl");
entity_set_origin(iWeapon2, fCoords);
entity_set_int(iWeapon2, EV_INT_rendermode, kRenderTransAlpha)
entity_set_int(iWeapon2, EV_FL_renderamt, 0)
attach_view(iPlayer, iWeapon2);
entity_set_int(iWeapon, EV_INT_iuser1, iWeapon2);
}
}
public __think_custom_weapon__(const iEnt)
{
static iOwner
iOwner = entity_get_edict(iEnt, EV_ENT_owner);
static iEnt2
iEnt2 = entity_get_int(iEnt, EV_INT_iuser1);
static Float:fCoords[3];
entity_get_vector(iOwner, EV_VEC_origin, fCoords);
entity_set_origin(iEnt, fCoords);
entity_set_origin(iEnt2, fCoords);
static Float:fViewAngles[3];
entity_get_vector(iOwner, EV_VEC_v_angle, fViewAngles);
entity_set_vector(iEnt2, EV_VEC_angles, fViewAngles);
fViewAngles[0] = -fViewAngles[0];
entity_set_vector(iEnt, EV_VEC_angles, fViewAngles);
entity_set_float(iEnt, EV_FL_nextthink, 0.001);
}