like reconnoiter said, you have to make sure that the code for attaching the object is called after the entity has been animated.

I'd do it like this:

create a function for attaching the object to your player model. you could use parameters to specify which object to attach aswell as the player model that it needs to be attached to.

void AttachObjectToPlayer(ENTITY * Player, ENTITY * Object);

inside that function you'd set the objects position like you normally do, just without a while.
and then use it in your player code like that:

ent_animate(....);
AttachObjectToPlayer(PlayerEnt, SwordEnt);


POTATO-MAN saves the day! - Random