ACE3/addons/interaction/functions/fnc_joinTeam.sqf

40 lines
887 B
Plaintext
Raw Normal View History

/*
* Author: commy2
2015-09-28 13:37:18 +00:00
* Unit joins a fire team.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Team <STRING>
*
2015-09-28 13:37:18 +00:00
* Return Value:
* None
*
* Example:
2015-09-28 13:37:18 +00:00
* [player, "YELLOW"] call ace_interaction_fnc_joinTeam
*
* Public: No
*/
2015-01-11 23:13:47 +00:00
#include "script_component.hpp"
2015-01-11 19:32:51 +00:00
2015-09-28 13:37:18 +00:00
params ["_unit", "_team"];
2015-01-11 19:32:51 +00:00
2015-09-28 13:37:18 +00:00
// make sure correct team is set on JIP
_unit setVariable [QGVAR(assignedFireTeam), _team, true];
2015-01-11 19:32:51 +00:00
2015-09-28 13:37:18 +00:00
// join fire team on every machine in that group
["assignTeam", units group _unit, [_unit, _team]] call EFUNC(common,targetEvent);
2015-01-11 19:32:51 +00:00
2015-09-28 13:37:18 +00:00
// display message
if (_unit == ACE_player) then {
2015-09-28 13:37:18 +00:00
private "_message";
if (_team == "MAIN") then {
_message = localize LSTRING(LeftTeam);
} else {
2015-05-28 19:59:04 +00:00
_team = localize format [LSTRING(Team%1), _team];
2015-09-28 13:37:18 +00:00
_message = format [localize LSTRING(JoinedTeam), _team];
};
2015-01-11 19:32:51 +00:00
2015-09-28 13:37:18 +00:00
["displayTextStructured", _message] call EFUNC(common,localEvent);
2015-01-11 19:32:51 +00:00
};