Its very simple. I know at least 2 ways.
1. Attaching in WED rightklick, "properties...", "attached", "open" -> entity (must be in level already). Then select the first script below for the attached entity.
2. Creating an entity by script in second code:
action carry_weapon
{
my.passable=on; // weapons must be passable, otherwise collision...
if(my.parent) {you=my.parent;} // for the case of attachment in WED
while(you)
{
vec_set(my.x, you.x);
vec_set(my.pan, you.pan);
my.frame=you.frame; // if animation is required
my.nextframe=you.nextframe; // if animation is required, importand!
wait(1);
}
ent_remove(me);
}
action actor_with_weapon
{
ent_create("weapon_x.mdl", my.x, carry_weapon);
...