Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. /*
  2. # HEADER #
  3. Script: Common\Functions\Common_EquipVehicleCargo.sqf
  4. Alias: CTI_CO_FNC_EquipVehicleCargo
  5. Description: Equips the cargo of a vehicle
  6. Author: Benny
  7. Creation Date: 31-08-2016
  8. Revision Date: 31-08-2016
  9.  
  10. # PARAMETERS #
  11. 0 [Object]: The vehicle
  12. 1 [Array]: The gear (items, weapons, magazines, backpacks...)
  13.  
  14. # RETURNED VALUE #
  15. None
  16.  
  17. # SYNTAX #
  18. [OBJECT, GEAR] call CTI_CO_FNC_EquipVehicleCargo
  19.  
  20. # EXAMPLE #
  21. [vehicle player, ["arifle_mxc_f", "30rnd_65x39_caseless_mag", "30rnd_65x39_caseless_mag"]] call CTI_CO_FNC_EquipVehicleCargo;
  22. */
  23.  
  24. private ["_gear", "_vehicle"];
  25.  
  26. _vehicle = _this select 0;
  27. _gear = _this select 1;
  28.  
  29. //--- Clear the vehicle before applying it's new cargo
  30. clearItemCargoGlobal _vehicle;
  31. clearMagazineCargoGlobal _vehicle;
  32. clearWeaponCargoGlobal _vehicle;
  33. clearBackpackCargoGlobal _vehicle;
  34.  
  35. _loaded = [];
  36.  
  37. {
  38. _item = _x;
  39. _item = toUpper _item; // set to upper case.
  40. if !(_item in _loaded) then {
  41. _count = {_x == _item} count _gear;
  42. _loaded pushBack _item;
  43.  
  44. if (isClass (configFile >> 'CfgVehicles' >> _item)) then {
  45. _vehicle addBackpackCargoGlobal [_item, _count];
  46. } else {
  47. _vehicle addItemCargoGlobal [_item, _count];
  48. };
  49. };
  50. } forEach _gear;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement