void apply_sword(){
VECTOR ang, pos;
while (you){ // do as long player != NULL
// move with players animation
vec_for_bone(pos, you, "Right Hand"); // get xyz pos of hand bone
ang_for_bone(ang, you, "Right Hand"); // get rotation of hand bone
vec_set(my.x, pos.x); // set xyz
vec_set(my.pan, ang); // set rotation
// optional animation
//my.skill1 += time_step;
//ent_animate(me, "idle", my.skill1, ANM_CYCLE);
wait(1);
}
ptr_remove(me); // no more player ? remove weapon
}
..
action myPlayer()
{
player = me;
// create the sword and apply to players hand
ent_create("sword.mdl", vector(player.x, player.y, player.z), apply_sword);
}