this is my code, but the entity doesnt follow the player when it walks, and it doesnt always creates behind, if the player faces in the opositive diction the entity created ahead.

ent_create("newentity.mdl",nullvector,entity);


function entity()
{
while (my)
{
vec_set(my.x, vector(0, -4, 3));
vec_rotate(my.x, player.pan);
vec_add(my.x, player.x);
my.pan = player.pan;
wait (-1);
ent_remove(my);
}
}