ACE3/addons/common/functions/fnc_getUavControlPosition.sqf

33 lines
680 B
Plaintext
Raw Normal View History

#include "script_component.hpp"
/*
2015-09-21 11:08:10 +00:00
* Author: PabstMirror
* Returns the seat position of a UAV that the unit is activly controling.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Position <STRING>
* "" = not connected to anything or activly controling
* "DRIVER"
* "GUNNER"
*
* Example:
* [ACE_Player] call ace_common_fnc_getUavControlPosition
*
* Public: Yes
*/
params [["_unit", objNull, [objNull]]];
2015-09-21 11:08:10 +00:00
private _uav = getConnectedUAV _unit;
2015-09-21 11:08:10 +00:00
if (isNull _uav) exitWith {""};
2015-09-21 11:08:10 +00:00
private _positionArray = UAVControl _uav;
private _playerIndex = _positionArray find _unit;
2015-09-21 11:08:10 +00:00
if (_playerIndex == -1) exitWith {""};
_positionArray select (_playerIndex + 1)