Weapon Crate Script

Posts 1–2 of 2 · Page 1 of 1
Weapon Crate Script
Code:
// Written By Bush Wookie 12/03/2013 10:28 GMT+0
_dir = getdir vehicle player;
_pos = getPos vehicle player;
_pos = [(_pos select 0)+1.5*sin(_dir),(_pos select 1)+1.5*cos(_dir),0];
_box = createVehicle ["box_NATO_AMMO_F", _pos, [], 0, 'CAN_COLLIDE']; //Change box_NATO_AMMO_F to what ever type of weapon box you want

clearWeaponCargo _box;
clearMagazineCargo _box;
clearItemCargo _box;
clearBackpackCargo _box;

_cfgweapons = configFile >> "CfgWeapons";
_weapons = [];
for "_i" from 0 to (count _cfgWeapons)-1 do
{
_cur_wep = _cfgweapons select _i;
			
	if(isClass _cur_wep) then
	{
		_classname = configName _cur_wep;
		_wep_type = getNumber(_cur_wep >> "type");
		_scope = getNumber(_cur_wep >> "scope");
		_picture = getText(_cur_wep >> "picture");
		if(_scope >= 2 && _wep_type in [1,2,4,4096] && _picture != "" && !(_classname in _weapons) && _classname != "NVGoggles") then
		{
			_weapons set[count _weapons, _classname];
		};
	};
};
		
_cfgweapons = configFile >> "CfgMagazines";
_magazines = [];
		
for "_i" from 0 to (count _cfgWeapons)-1 do
{
_cur_wep = _cfgweapons select _i;
			
	if(isClass _cur_wep) then
	{
		_classname = configName _cur_wep;
		_scope = getNumber(_cur_wep >> "scope");
		_picture = getText(_cur_wep >> "picture");
		if(_scope >= 2 && _picture != "" && !(_classname in _magazines)) then
		{
			_magazines set[count _magazines, _classname];
		};
	};
};
		
{ _box addWeaponCargo [_x,50]; } foreach _weapons; //Change 50 to the amount of each weapon you want
{ _box addMagazineCargo [_x,50]; }foreach _magazines; //Change 50 to the amount of each mag you want
	
_cfgweapons = configFile >> "CfgWeapons";
_items = [];
		
for "_i" from 0 to (count _cfgWeapons)-1 do
{
_cur_wep = _cfgweapons select _i;
			
	if(isClass _cur_wep) then
	{
		_classname = configName _cur_wep;
		_wep_type = getNumber(_cur_wep >> "type");
		_scope = getNumber(_cur_wep >> "scope");
		_picture = getText(_cur_wep >> "picture");
		if(_scope >= 2 && _wep_type in [131072,4096] && _picture != "" && !(_classname in _items) && _classname != "Binocular") then
		{
			_items set[count _items, _classname];
		};
	};
};
		
{ _box addItemCargo [_x,50]; } foreach _items; //change 50 to the amount of each item you want
		
_cfgweapons = configFile >> "CfgVehicles";
_backpacks = [];
		
for "_i" from 0 to (count _cfgWeapons)-1 do
{
_cur_wep = _cfgweapons select _i;
			
	if(isClass _cur_wep) then
	{
		_classname = configName _cur_wep;
		_wep_type = getText(_cur_wep >> "vehicleClass");
		_scope = getNumber(_cur_wep >> "scope");
		_picture = getText(_cur_wep >> "picture");
		if(_scope >= 2 && _wep_type == "Backpacks" && _picture != "" && !(_classname in _backpacks)) then
		{
			_backpacks set[count _backpacks, _classname];
		};
	};
};
		
{ _box addBackPackCargo [_x,5]; } foreach _backpacks; // change 5 to the amount of each backpack you want
Save as a .sqf file and then execute it
I'm sorry but this is pretty much complete copy pasta, and it still doesnt have clothing or first aid kits.
Posts 1–2 of 2 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us