Skip to content

Commit

Permalink
[X_LIB] Added function: ALIVE_fnc_detectDLC
Browse files Browse the repository at this point in the history
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;
  • Loading branch information
DarrellJMartin committed Sep 13, 2023
1 parent 2dc1399 commit 8e45d62
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions addons/x_lib/functions/misc/fnc_detectDLC.sqf
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8e45d62

Please sign in to comment.