Are you aware of the engine functions vec_for_ent and vec_to_ent ?


Always learn from history, to be sure you make the same mistakes again...