canAdd: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Killzone Kid (talk | contribs) (alt syntax) |
||
Line 7: | Line 7: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Checks if given object can be stored in inventory of given object or any inventory container ([[uniform]], [[vest]], [[backpack]]) of given unit. | | Checks if given object can be stored in inventory of given object or any inventory container ([[uniform]], [[vest]], [[backpack]]) of given unit. |= Description | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| object '''canAdd''' item |= Syntax | | object '''canAdd''' item |= Syntax | ||
|p1= object: [[Object]] - unit or container |= PARAMETER1 | |||
|p1= | |||
|p2= item: [[String]] - Config class |= PARAMETER2 | |p2= item: [[String]] - Config class |= PARAMETER2 | ||
Line 19: | Line 18: | ||
| [[Boolean]] |= RETURNVALUE | | [[Boolean]] |= RETURNVALUE | ||
| s2 =object '''canAdd''' [item, count] (''Since Arma 3 v1.55.133607'') |= Syntax | |||
|p21= object: [[Object]] - unit or container |= PARAMETER1 | |||
|p22= [item, count]: [[Array]] |= PARAMETER1 | |||
|p23= item: [[String]] - Config class |= PARAMETER2 | |||
|p24= count: [[Number]] - desired quantity |= PARAMETER1 | |||
| r2= [[Boolean]] |= RETURNVALUE | |||
|x1= <code>[[if]] ([[player]] [[canAdd]] "FirstAidKit") [[then]] { | |x1= <code>[[if]] ([[player]] [[canAdd]] "FirstAidKit") [[then]] { | ||
Line 33: | Line 40: | ||
}; | }; | ||
</code>|= EXAMPLE2 | </code>|= EXAMPLE2 | ||
|x3= <code>car [[canAdd]] <nowiki>[</nowiki>[[currentWeapon]] [[player]], 50];</code>|= EXAMPLE3 | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ |
Revision as of 00:50, 5 December 2015
Description
- Description:
- Checks if given object can be stored in inventory of given object or any inventory container (uniform, vest, backpack) of given unit.
- Groups:
- Uncategorised
Syntax
- Syntax:
- object canAdd item
- Parameters:
- object: Object - unit or container
- item: String - Config class
- Return Value:
- Boolean
Alternative Syntax
- Syntax:
- object canAdd [item, count] (Since Arma 3 v1.55.133607)
- Parameters:
- object: Object - unit or container
- [item, count]: Array
- item: String - Config class
- count: Number - desired quantity
- Return Value:
- Boolean
Examples
- Example 1:
if (player canAdd "FirstAidKit") then { player addItem "FirstAidKit"; } else { hint "Not enough space"; };
- Example 2:
if (_box canAdd "FirstAidKit") then { _box addWeaponCargo ["FirstAidKit", 1]; } else { hint "Not enough space"; };
- Example 3:
car canAdd [currentWeapon player, 50];
Additional Information
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
Bottom Section
- Posted on November 29, 2015 - 00:02 (UTC)
- Jonpas
-
Can also be used on any object that has inventory, not only player inventory containers.
Where _box is B_supplyCrate_F:// Empty _box canAdd "FirstAidKit"; -> true // Full _box canAdd "FirstAidKit"; -> false