Try this and see how it goes.
var camera_switch = 1;
function camera_invehicle()
{ while(1)
{ if(camera_switch == 2)
{ camera_invehicle code here }
wait(1);
} }
function camera_outvehicle()
{ while(1)
{ if(camera_switch == 1)
{ camera_outvehicle code here }
wait(1);
} }
action player()
{ camera_outvehicle();
camera_invehicle();
while(1)
{ if (player.x != vehicle.x) { camera_switch = 1; } // the player is NOT in the vehicle
else { camera_switch = 2: } // the player IS in the vehicle
wait(1);
}
}
I would prefer to see it like this. Less potential for problems later...
action player()
{ while(1)
{ if (player.x != vehicle.x)
{ camera_outvehicle code here } // the player is NOT in the vehicle
else
{ camera_invehicle code here } // the player IS in the vehicle
///other stuff in here if you want...
wait(1);
}
}