The problem is, the camera always spawns at 0,0,0. I have looked at many different threads where people have had this problem, but no solution was ever found. So I hope this might be different:
Code:
get_user_aiming(id, entid, entbody, 9999);
if(!is_user_alive(entid)) {
return PLUGIN_HANDLED;
}
g_victim[id] = entid;
new camera = create_entity("info_target")
new Float:origin[3]
entity_get_vector(entid, EV_VEC_origin, origin);
entity_set_origin(camera, origin)
new Float:maxs[3] = {0.0,0.0,0.0}
new Float:mins[3] = {0.0,0.0,0.0}
entity_set_size(camera,mins,maxs)
entity_set_int(camera, EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_int(camera, EV_INT_solid, SOLID_NOT)
entity_set_edict(camera, EV_ENT_aiment, entid)
entity_set_string(camera, EV_SZ_classname, "camera" )
DispatchSpawn(camera)
g_pcamera[id] = camera;
attach_view(id, g_pcamera[id])
set_task(0.1,"angles",id);
return PLUGIN_HANDLED;
}
public angles(id) {
if(g_victim[id] == 0) return PLUGIN_HANDLED;
new Float:angles[3];
entity_get_vector(g_victim[id], EV_VEC_angles, angles)
entity_set_vector(g_pcamera[id], EV_VEC_angles, angles)
set_task(0.1,"angles",id);
return PLUGIN_HANDLED;
}
I make the camera, set it on the target's origin, set it to follow the target, make the player see through the camera, then cosntantly update the camera's angels to match the targets.
Neither the origin setting nor angle update works, but the player can see through the camera at 0,0,0.
__________________