Rewritten

This commit is contained in:
IT07 2016-05-26 15:58:05 +02:00
parent 67bfc72dab
commit 095b313821

View File

@ -7,44 +7,57 @@
Params:
for global(!) systemChat message:
_this select 0: FORMATTED STRING - thing to send
_this select 1: STRING - must be "sys"
_this select 1: ARRAY - objects to send message to. If empty, broadcast will go to all players
_this select 2: STRING - must be "sys"
for mission announcement:
_this: ARRAY
_this select 0: ARRAY
_this select 0 select 0: FORMATTED STRING - Message line
_this select 0 select 0: SCALAR - broadcast type (determines the color of the message icon)
_this select 0 select 1: STRING - announcement title
_this select 0 select 2: ARRAY - (optional) only send message to those units
_this select 1: STRING - (optional) must be empty or nil
_this select 0 select 2: FORMATTED STRING - Message line
_this select 1: ARRAY - objects to send message to. If empty, broadcast will go to all players
_this select 2: STRING - (optional) must be empty or nil | for systemChat broadcast, use "sys"
Returns:
nothing
*/
private ["_msg"];
_msg = param [0, "", [[],format[""]]];
if not(_msg isEqualTo "") then
{
private ["_mode"];
_mode = param [1, "", [""]];
if (count allPlayers > 0) then
if (_this isEqualType []) then
{
_targets = (_this select 0) param [2, [],[[]]];
_broadCast =
{
{
if (isPlayer _x AND alive _x) then
private ["_arr"];
if (count _this isEqualTo 0) then
{
_arr = allPlayers;
} else
{
_arr = _this;
};
{
VEMFrClientMsg = [_msg, _mode];
(owner _x) publicVariableClient "VEMFrClientMsg";
};
} forEach _this;
};
if (count _targets isEqualTo 0) then
{
allPlayers call _broadCast;
} else
{
_targets call _broadCast;
};
if (isPlayer _x AND alive _x) then
{
VEMFrMsgToClient = [_msg, _mode];
(owner _x) publicVariableClient "VEMFrMsgToClient";
};
} forEach _arr;
};
_targets = param [1, [], [[]]];
_mode = param [2, "", [""]];
if (_this select 0 isEqualType []) then
{
_mode = (_this select 0) param [0, -1, [0]];
_title = (_this select 0) param [1, "DEFAULT TITLE", [""]];
_msgLine = (_this select 0) param [2, "Default message", [""]];
_msg = [_mode, _title, _msgLine];
_targets call _broadCast;
};
if (_this select 0 isEqualType "") then
{
_msg = param [0, "", [""]];
_targets call _broadCast;
};
} else
{
["broadcast.sqf", 0, format["_this is not an ARRAY: %1", _this]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
};