Want more features on Pastebin? Sign Up, it's FREE!
Guest

arma crate fill

By: a guest on Oct 12th, 2013  |  syntax: None  |  size: 3.46 KB  |  views: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2. Script by Ghost (main design by Kronzky) Will add all weapons, items, magazines to an ammo box and refill it every 1200 seconds. no more manual typing of weapon/magazine/item names.
  3. put null0 = this execVM "scripts\ammo.sqf"; in the initline of an ammo box.
  4. */
  5.  
  6. _wepcount = 10;
  7. _magcount = 30;
  8.  
  9. clearweaponcargo _this;
  10. clearmagazinecargo _this;
  11.  
  12. _weaponsList = [];
  13. _namelist = [];
  14. _cfgweapons = configFile >> "cfgWeapons";
  15. for "_i" from 0 to (count _cfgweapons)-1 do {
  16.         _weapon = _cfgweapons select _i;
  17.         if (isClass _weapon) then {
  18.                 _wCName = configName(_weapon);
  19.                 _wDName = getText(configFile >> "cfgWeapons" >> _wCName >> "displayName");
  20.                 _wModel = getText(configFile >> "cfgWeapons" >> _wCName >> "model");
  21.                 _wType = getNumber(configFile >> "cfgWeapons" >> _wCName >> "type");
  22.                 _wscope = getNumber(configFile >> "cfgWeapons" >> _wCName >> "scope");
  23.                 _wPic =  getText(configFile >> "cfgWeapons" >> _wCName >> "picture");
  24.                 _wDesc = getText(configFile >> "cfgWeapons" >> _wCName >> "Library" >> "libTextDesc"); 
  25.  
  26.                 _isFake = false;
  27.                 _wHits=0;
  28.                 _mags=[];
  29.                 _muzzles = getArray(configfile >> "cfgWeapons" >> _wCName >> "muzzles");
  30.                 if ((_muzzles select 0)=="this") then {
  31.                         _muzzles=[_wCName];
  32.                         _mags = getArray(configfile >> "cfgWeapons" >> _wCName >> "magazines");
  33.                 } else {
  34.                         {
  35.                                 _muzzle=_x;
  36.                                 _mags = getArray(configfile >> "cfgWeapons" >> _wCName >> _muzzle >> "magazines");
  37.                         }forEach _muzzles;
  38.                 };
  39.                 {
  40.                         _ammo = getText(configfile >> "cfgMagazines" >> _x >> "ammo");
  41.                         _hit = getNumber(configfile >> "cfgAmmo" >> _ammo >> "hit");
  42.                         _wHits = _wHits + _hit;
  43.                 }forEach _mags;
  44.  
  45.                 if ((_wCName!="") && (_wDName!="") && (_wModel!="") && (_wPic!="")) then {
  46.                         if !(_wDName in _namelist) then {
  47.                                 _weaponsList = _weaponsList + [[_wCName,_wDName,_wPic,_wDesc]];
  48.                                         _namelist = _namelist + [_wDName];
  49.                         };
  50.                 };
  51.         };
  52.         if (_i % 10==0) then {
  53.                 hintsilent format["Loading Weapons List... (%1)",count _weaponsList];
  54.                 sleep .0001;
  55. };
  56. };
  57. hint "";
  58. _namelist=nil;
  59.  
  60. _magazinesList = [];
  61. _namelist = [];
  62. _cfgmagazines = configFile >> "cfgmagazines";
  63. for "_i" from 0 to (count _cfgmagazines)-1 do {
  64.         _magazine = _cfgmagazines select _i;
  65.         if (isClass _magazine) then {
  66.                 _mCName = configName(_magazine);
  67.                 _mDName = getText(configFile >> "cfgmagazines" >> _mCName >> "displayName");
  68.                 _mModel = getText(configFile >> "cfgmagazines" >> _mCName >> "model");
  69.                 _mType = getNumber(configFile >> "cfgmagazines" >> _mCName >> "type");
  70.                 _mscope = getNumber(configFile >> "cfgmagazines" >> _mCName >> "scope");
  71.                 _mPic =  getText(configFile >> "cfgmagazines" >> _mCName >> "picture");
  72.                 _mDesc = getText(configFile >> "cfgmagazines" >> _mCName >> "Library" >> "libTextDesc");       
  73.  
  74.                 if ((_mCName!="") && (_mDName!="") && (_mModel!="")) then {
  75.                         if !(_mDName in _namelist) then {
  76.                                 _magazinesList = _magazinesList + [[_mCName,_mDName,_mPic,_mDesc]];
  77.                                         _namelist = _namelist + [_mDName];
  78.                         };
  79.                 };
  80.         };
  81.         if (_i % 10==0) then {
  82.                 hintsilent format["Loading magazines List... (%1)",count _magazinesList];
  83.                 sleep .0001;
  84. };
  85. };
  86. hint "";
  87. _namelist=nil;
  88.  
  89. while {alive _this} do
  90. {
  91. clearweaponcargo _this;
  92. clearmagazinecargo _this;
  93.  
  94. for "_i" from 0 to (count _weaponsList)-1 do {
  95.         _weapon = _weaponsList select _i;
  96.         _this addweaponcargo [_weapon select 0,_wepcount];
  97. };
  98.  
  99. for "_i" from 0 to (count _magazinesList)-1 do {
  100.         _magazine = _magazinesList select _i;
  101.         _this addmagazinecargo [_magazine select 0,_magcount];
  102. };
  103.  
  104.  
  105.  
  106. sleep 1200;
  107. };
clone this paste RAW Paste Data