Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report backpacks with CBA_fnc_getItemConfig #1223

Merged
merged 2 commits into from
Sep 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions addons/common/fnc_getItemConfig.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Description:
A function used to return the config of an item.

Parameters:
_weapon - Any kind of item, weapon or magazine class name <STRING>
_item - Any kind of item, weapon or magazine class name <STRING>

Returns:
_config - Item config. <CONFIG>
Expand All @@ -23,16 +23,24 @@ Author:
---------------------------------------------------------------------------- */
SCRIPT(getItemConfig);

params [["_weapon", "", [""]]];
params [["_item", "", [""]]];

private _result = configNull;

{
private _config = configFile >> _x >> _weapon;
private _config = configFile >> _x >> _item;

if (isClass _config) exitWith {
_result = _config;
};
} forEach ["CfgWeapons", "CfgMagazines", "CfgGlasses"];

if (isNull _result) then {
private _config = configFile >> "CfgVehicles" >> _item;

if (getNumber (_config >> "isBackpack") isEqualTo 1) then {
_result = _config;
};
};

_result