At the moment there is no way of reliably limit player to 1st person view on foot and allow both 1st and 3rd person view in vehicles, especially after BIS broke switchCamera command: http://feedback.arma3.com/view.php?id=11577
Even with switchCamera fixed it is far from optimal solution to check player cameraView on each frame and reset to 1st person when player switched to 3rd.
Here are 2 proposed solutions.
- Add another option to server/game difficulty config "3rdPersonViewVehicle" next to "3rdPersonView". This is pretty straight forward and no doubt this had been asked million times already.
- Add scripting command "difficultyEnable". We already have "difficultyEnabled" command which allows to see if "3rdPersonView" is enabled. Why not add a command that would enable or disable given difficulty on the fly. This way as person enters a vehicle
difficultyEnable ["3rdPersonView", true]
as player exits the vehicle
difficultyEnable ["3rdPersonView", false]
This command will also allow for easy difficulty setup for mission maker.