Sarge-AI/sarge/UPSMON/COMMON/Group/fnc/UPSMON_SetLeaderGrp.sqf
Teh Dango 7067ad9b0a 2.2.3
Check the change log for details
2016-08-18 22:58:49 -04:00

39 lines
710 B
Plaintext

/****************************************************************
File: UPSMON_SetLeaderGrp.sqf
Author: Azroul13
Description:
Set the leader of the group
Parameter(s):
<--- Unit or Group
Returns:
---> Leader
****************************************************************/
private ["_unit","_Leader", "_grp"];
_unit = _this select 0;
_grp = group _unit;
_Leader = leader (_grp);
if ((_unit iskindof "Man")) then {
if(_unit != _Leader) then {
_grp selectLeader _unit;
};
} else {
if (!isnull(commander _unit) ) then {
_unit = commander _unit;
}else{
if (!isnull(driver _unit) ) then {
_unit = driver _unit;
}else{
_unit = gunner _unit;
};
};
_grp selectLeader _unit;
};
_Leader