ACE3/addons/common/functions/fnc_getUavControlPosition.sqf

35 lines
687 B
Plaintext
Raw Normal View History

/*
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
*/
2015-01-13 19:56:02 +00:00
#include "script_component.hpp"
2015-09-21 11:08:10 +00:00
params ["_unit"];
2015-05-14 18:06:06 +00:00
private ["_uav", "_positionArray", "_playerIndex"];
_uav = getConnectedUAV _unit;
2015-09-21 11:08:10 +00:00
if (isNull _uav) exitWith {""};
2015-09-21 11:08:10 +00:00
_positionArray = UAVControl _uav;
_playerIndex = _positionArray find _unit;
2015-09-21 11:08:10 +00:00
if (_playerIndex == -1) exitWith {""};
_positionArray select (_playerIndex + 1)