From 8e45d62c0cc3608bd65a71a2c9fbcda654985b94 Mon Sep 17 00:00:00 2001 From: Darrell Martin Date: Wed, 13 Sep 2023 09:32:49 +0100 Subject: [PATCH] [X_LIB] Added function: ALIVE_fnc_detectDLC Description: Detects CDLC present in getLoadedModsInfo array Parameters: Scalar - DLC appId Returns: Boolean - true if search term is found, false if not Example: (App ID, 1175380: Arma 3 Creator DLC: Spearhead 1944) [1175380] call ALIVE_fnc_detectDLC; --- addons/x_lib/functions/misc/fnc_detectDLC.sqf | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 addons/x_lib/functions/misc/fnc_detectDLC.sqf diff --git a/addons/x_lib/functions/misc/fnc_detectDLC.sqf b/addons/x_lib/functions/misc/fnc_detectDLC.sqf new file mode 100644 index 000000000..0b5ce0cb5 --- /dev/null +++ b/addons/x_lib/functions/misc/fnc_detectDLC.sqf @@ -0,0 +1,35 @@ +#include "\x\alive\addons\x_lib\script_component.hpp" +SCRIPT(detectDLC); +/* ---------------------------------------------------------------------------- +Function: ALIVE_fnc_detectDLC + +Description: +Detects CDLC present in getLoadedModsInfo array + +Parameters: Scalar - DLC appId +Returns: Boolean - true if search term is found, false if not + +Example: +(App ID, 1175380: Arma 3 Creator DLC: Spearhead 1944) +[1175380] call ALIVE_fnc_detectDLC; + +Author: +Jman +---------------------------------------------------------------------------- */ + +private ["_itemID","_isPresent","_listAddons","_thisRow"]; + +DEFAULT_PARAM(9999999,_itemID ,[]); + + private _isPresent = 0; + private _listAddons = getLoadedModsInfo; + { + if (count _x > 0) then { + _thisRow = [_x] call ALiVE_fnc_toString; + ["ALIVE_fnc_detectDLC - Loaded Addon: %1", _thisRow] call ALIVE_fnc_dump; + _isPresent = [_itemID, _thisRow] call BIS_fnc_inString; + if (_isPresent) then { break; }; + }; + } forEach _listAddons; + +_isPresent \ No newline at end of file