Created
December 10, 2017 18:34
-
-
Save bosoy/0bac431c5df8897e2fcc7fea7e27c2f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Function: ACE_fnc_deleteLoadCargo | |
Description: | |
A function used to delete cargo from a vehicle. | |
Parameters: | |
_veh - Vehicle to load cargo into. (Must exist) [Object] | |
_cargo - Cargo object to load. (Must exist) [Array of one or more objects] | |
Returns: | |
nothing | |
Example: | |
(begin example) | |
[myTruck,[myCrate1, myCrate2]] call ACE_fnc_deleteLoadCargo; // delete myCrate1, myCrate2 cargo | |
or | |
[myTruck] call ACE_fnc_deleteLoadCargo; //delete all cargo | |
(end) | |
Author: | |
ArseniyK, Dimon UA | |
*/ | |
private["_veh","_cargo", "_currentcontent", "_item","_canload"]; | |
_veh = _this select 0; | |
_cargo = _this select 1; | |
_canload = [_veh] call ACE_fnc_canLoadCargo; // проверяем авто на профпригодность | |
if _canload then | |
{ | |
sleep 5; | |
_currentcontent = _veh getVariable "ace_sys_cargo_content"; | |
if (!isNil "_cargo" && {count _cargo > 0} && {!isNil "_currentcontent"}) then | |
{ | |
{ | |
_item=_x; | |
{ | |
if (typeOf _x == _item) then | |
{ | |
_currentcontent set [_forEachIndex, objNull]; | |
_currentcontent = _currentcontent - [objNull]; | |
_veh setVariable ["ace_sys_cargo_content", _currentcontent, true]; | |
}; | |
}foreach _currentcontent; | |
} foreach _cargo; | |
}else{ | |
_veh setVariable ["ace_sys_cargo_content",[],true]; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment