mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
32 lines
848 B
Plaintext
32 lines
848 B
Plaintext
|
#include "script_component.hpp"
|
||
|
/*
|
||
|
* Author: Dedmen
|
||
|
* Return how many items of type _itemType the player has in his containers (Uniform, Vest, Backpack)
|
||
|
* Doesn't count assignedItems, weapons, weapon attachments, magazines in weapons
|
||
|
*
|
||
|
* Arguments:
|
||
|
* 0: Unit <OBJECT>
|
||
|
* 1: Classname of item (Case-Sensitive) <STRING>
|
||
|
*
|
||
|
* Return Value:
|
||
|
* Item Count <NUMBER>
|
||
|
*
|
||
|
* Example:
|
||
|
* [bob, "FirstAidKit"] call ace_common_fnc_getCountOfItem
|
||
|
*
|
||
|
* Public: Yes
|
||
|
*/
|
||
|
|
||
|
params ["_unit", "_itemType"];
|
||
|
|
||
|
private _countItemsInContainer = {
|
||
|
(getItemCargo _this) params ["_itemTypes", "_itemCounts"];
|
||
|
|
||
|
private _index = _itemTypes find _itemType;
|
||
|
_itemCounts param [_index, 0]
|
||
|
};
|
||
|
|
||
|
((uniformContainer _unit) call _countItemsInContainer) +
|
||
|
((vestContainer _unit) call _countItemsInContainer) +
|
||
|
((backpackContainer _unit) call _countItemsInContainer)
|