After some tests, it didn't worked. I decided to substract fvOFS[2] from fStartPos[2] at it seems working, but when a player is ducking, the entity gets close to it.
Code:
public ent_ThinkPre
(iEnt
)
{
if(!pev_valid
(iEnt
))
return
static className
[32]
pev
(iEnt, pev_classname, className, charsmax
(className
))
if(!
equali(className, g_szClassName
))
{
return
}
new id = pev
(iEnt, pev_owner
)
if(is_user_alive(id
))
{
new Float:fStartPos
[3],
Float:fvOFS
[3],
Float:fAngles
[3]
pev
(id, pev_origin, fStartPos
)
pev
(id, pev_view_ofs, fvOFS
)
pev
(id, pev_angles, fAngles
)
fAngles
[0] =
0.0
fStartPos[2] -= fvOFS[2]
set_pev
(iEnt, pev_origin, fStartPos
)
set_pev
(iEnt, pev_angles, fAngles
)
shift_entity_position
(iEnt,
100.0,
0.0, -fvOFS
[2])
if(get_user_button
(id
) & IN_FORWARD
)
{
entity_set_aim
(iEnt, id,
true);
}
else
{
entity_set_aim
(iEnt, id
);
}
}
engfunc
(EngFunc_DropToFloor, iEnt
)
set_pev
(iEnt, pev_nextthink,
get_gametime() +
0.01)
}
__________________