Hello Community

I have been struggling with what sounds like an easy idea.
I am trying to have my player approach a teleporter(MDL) and teleport to another teleporter.
Now the obvious point is that when the player teleports from one to the other, He should not keep teleporting back and forth, thus keeping him in a continuous loop.
I am trying to do this with one single action.
Now, my current solution appears as though it should work correctly. But it doesn't.
action telehole_act(){
set(me,PASSABLE | ENABLE_SCAN);
reset(me, INVISIBLE);//Glitch? ???
my.material = mtl_basic_shader;
while(player_active == 0){wait(1);}
VECTOR telepos;
vec_set(telepos.x, my.skill1);
my.skill10 = 0;
while(1){wait(1);
if(vec_dist(my.x,player.x)<35 && my.skill10 == 0){
vec_set(player.x,telepos.x);
result = c_scan(player.x,player.pan,vector(360,0,50), SCAN_ENTS | SCAN_LIMIT);
if(result > 5){
if(you!=NULL){
you.skill10 = 1;
beep();
}
}
}
}
}
What I've done is set the teleport to passable, (so IGNORE_PASSABLE is not an option) and ENABLE SCAN to have only this entity scanned - which comes later.
Then in WED, I set the partnered teleports parnters x,y,z position into their skills 1,2,3 and store them into a temp vector.
by default, each teleport is active (skill10 = 0) and able to accept the player in the comming while loop, and checked with a vec_dist.
if the player is close enough it will teleport the player to the temppos.
[At this point, with no further code, the player would be stuck in a loop where he is sent back and forth, and unable to move. which would and does make sense]
Now, to make it so that when the player finishes his teleport, he doesnt teleport back, I've set a scan from the player. The scan should check for entities with enable scan, and if one has been found then set its skill10 = 1. Thus disabling the teleporter until I code more code to renable it.
However this is not the case.
When the player teleports, he becomes stuck on the first created in WED teleport. and no Beep sound is played informing me that the result did not find anything.
I've tried saying that if(you!= NULL && you!= player) then continue with the code. But setting it so that it recognizes if the entity it has scanned's skill99 == 1 is a good idea too. But that does not work.
So I thought it had to do with the fact that the player is teleported, and the following code happens before the player reached this tele-point. So I set a wait inside. That just made it so he fluently teleported back and forth, and didn't get stuck at the first created teleporter.
So. Why is this? Anyone know whats up? Im stumped.