_position = [1000,1000,0];
_className = "Land_OfficeCabinet_02_F";
_itemsToStore = [];
{
if (!(_x in _exempt)) then {
player removeWeapon _x;
_itemsToStore pushBack [1,_x];
};
} forEach weapons player;
{
if (!(_x in _exempt)) then {
player removeMagazine _x;
_itemsToStore pushBack [4,_x];
};
} forEach magazines player;
{
if (!(_x in _exempt)) then {
player removeItemFromUniform _x;
_itemsToStore pushBack [3,_x];
};
} forEach uniformItems player;
{
if (!(_x in _exempt)) then {
player removeItemFromVest _x;
_itemsToStore pushBack [3,_x];
};
} forEach vestItems player;
{
if (!(_x in _exempt)) then {
player removeItemFromBackpack _x;
_itemsToStore pushBack [3,_x];
};
} forEach backpackItems player;
if (uniform player in _uniform) then {_itemsToStore pushBack [2,(uniform player)]; removeUniform player;};
if (vest player in _vest) then {_itemsToStore pushBack [2,(vest player)]; removeVest player;};
if (headgear player in _headgear) then {_itemsToStore pushBack [2,(headgear player)]; removeHeadgear player;};
_locker = nearestObject [_position,_className];
diag_log "[Lockers] Waiting for not in use";
waitUntil { !(_locker getVariable ["locker_in_use",false]) };
diag_log "[Lockers] Adding items";
{
_type = _x select 0;
_item = _x select 1;
_lockerData = _locker getVariable ["locker_inv",[[],0,0,-1]];
_lockerInv = _lockerData select 0;
_itemWeight = ([_type,_item,1] call max_lockers_fnc_lockerItemWeight);
if (((_lockerData select 1) + _itemWeight) > (_lockerData select 2)) then {
hint (["STR_LOCKER_FULL","Max_Settings_Lockers","Lockers_Localization"] call theprogrammer_core_fnc_localize);
} else {
switch (_type) do {
case 0: {
_index = [_item,_lockerInv] call max_lockers_fnc_findIndexArray;
if (_index isEqualTo -1) then {
_lockerInv pushBack [_type,_item,1];
} else {
_val = (_lockerInv select _index) select 2;
_lockerInv set [_index,[_type,_item,(_val + 1)]];
};
};
case 1: {
_index = [_item,_lockerInv] call max_lockers_fnc_findIndexArray;
if (_index isEqualTo -1) then {
_lockerInv pushBack [_type,_item,1];
} else {
_val = (_lockerInv select _index) select 2;
_lockerInv set [_index,[_type,_item,(_val + 1)]];
};
};
case 2: {
_index = [_item,_lockerInv] call max_lockers_fnc_findIndexArray;
if (_index isEqualTo -1) then {
_lockerInv pushBack [_type,_item,1];
} else {
_val = (_lockerInv select _index) select 2;
_lockerInv set [_index,[_type,_item,(_val + 1)]];
};
};
case 3: {
_index = [_item,_lockerInv] call max_lockers_fnc_findIndexArray;
if (_index isEqualTo -1) then {
_lockerInv pushBack [_type,_item,1];
} else {
_val = (_lockerInv select _index) select 2;
_lockerInv set [_index,[_type,_item,(_val + 1)]];
};
};
case 4: {
_dataArray = _item splitString ",";
_item = (_dataArray select 0);
_ammo = parseNumber (_dataArray select 1);
_array = [];
{
_array pushBack [(_x select 1),(_x select 2),(_x select 3)];
} forEach _lockerInv;
_index = [_item,_array,_ammo] call max_lockers_fnc_findIndexArray;
if (_index isEqualTo -1) then {
_lockerInv pushBack [_type,_item,1,_ammo];
} else {
_val = (_lockerInv select _index) select 2;
_lockerInv set [_index,[_type,_item,(_val + 1),_ammo]];
};
};
};
};
_locker setVariable ["locker_inv",[_lockerInv,((_lockerData select 1) + _itemWeight),(_lockerData select 2),(_lockerData select 3)],true];
} forEach _itemsToStore;