Ok now i dunno why but i changed the script a bit.
I included a timeout and taken a other thign for checking if the player swims.
Now it keeps warping me in the top left corner of the level when i wlak on the bridge. WHY?
NPC Code:
//#CLIENTSIDE
if(created||timeout){
if(playerswimming){
drawoverplayer;
setshape2 14,9,{
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22
};
}
else{
drawunderplayer;
setshape2 14,9,{
22,22,22,22,22,22,22,22,22,22,22,22,22,22,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22
};
}
if(playerx in |x,x+10|&&playery in |y-1,y+9|){
attachplayertoobj 0,id;
}
else{
detachplayer;
}
timeout=.05;
}