The script command UAVControl unfortunately only reports a single unit. Here are the states:
When there is only unitA connected with a UAV terminal, the return is:
[unitA,""]
When there is only unitA in the gunner seat of the UAV, the return is:
[unitA,"GUNNER"]
When there is only unitA in the driver seat of the UAV, the return is:
[unitA,"DRIVER"]
So far, so good. The issue arises when there is more than one unit controlling different roles of the UAV. For example when there is a driver connected (unitA, using normal UAV terminal) and a gunner as well (unitB, using remoteControl and switchCamera script commands), UAVControl will return:
[unitA,"DRIVER"]
So no mention of the gunner. If the driver releases control while still keeping his UAV terminal connected, UAVControl will return:
[unitB,"GUNNER"]
If the gunner releases control (using objNull remoteControl and switchCamera), UAVControl will return:
[unitA,""]
The real-life problem that arises from this is that as soon as there is a driver present, I cannot find out if there is a gunner or not. If I allow a unit to take control of the gunner and there is already a gunner, the camera of the previous gunner goes all wonky, rendering the game unusable for that person.
I have been looking for workarounds to reliably detect if a UAV's gunner is being remote controlled, but so far I have found none. There doesn't seem to be a script command that returns the current controller of a unit, something like:
remoteController gunner _uav
with the return being the player object that is currently in control, or objNull if there isn't one.