can someone show me how to attach a sprite entity to the model?

my attempt was doing it like a camera but this may be wrong.
I think using vectors is wrong but Iam not sure of the alternative.
This crashes in attach_entity()

here are the key parts below
thanks

////////////////////////////
void attach_entity();


box = ent_create ("boat.mdl", vector(-400, 0, 570), attach_entity); //

ent_explo = ent_create("flash+3.tga", vector(-200, 0, 0), lightcolor);



void attach_entity()
{
while(1)
{
vec_set(ent_explo.x,my.x);
vec_set(ent_explo.y,my.y);
vec_set(ent_explo.z,my.z);
wait(1);
}
}