Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- AUTHOR: aeroson
- */
- if (isServer) then {
- private ["_box","_pos"];
- _box = _this select 0;
- _pos = getPosATL _box;
- _box setPos [_pos select 0, _pos select 1, -10];
- sleep 2;
- };
- if (isDedicated) exitWith {};
- private ["_box","_boxn","_pos","_dir","_up","_contentNames","_resupplyTime","_add","_contentCount","_contentData","_setBox","_createBox"];
- _box = _this select 0;
- _contentNames = _this select 1;
- _contentCount = if(count _this > 2) then { _this select 2; } else { 1; };
- _resupplyTime = if(count _this > 3) then { _this select 3; } else { 300; };
- _pos = getPosATL _box;
- _dir = vectorDir _box;
- _up = vectorUp _box;
- hideObject _box;
- clearMagazineCargo _box;
- clearWeaponCargo _box;
- clearItemCargo _box;
- clearBackpackCargo _box;
- _box enableSimulation false;
- _add = {
- private ["_cargo","_item","_count"];
- _cargo = _this select 0;
- _item = _this select 1;
- _count = _this select 2;
- if(isClass(configFile>>"CfgMagazines">>_item)) then {
- _cargo addMagazineCargo [_item,_count];
- } else {
- if(getNumber(configFile>>"CfgVehicles">>_item>>"isbackpack")==1) then {
- _cargo addBackpackCargo [_item,_count];
- } else {
- if(isClass(configFile>>"CfgWeapons">>_item>>"WeaponSlotsInfo")&&getNumber(configFile>>"CfgWeapons">>_item>>"showempty")==1) then {
- //_cargo addWeaponCargo [_item,_count];
- } else {
- _cargo addItemCargo [_item,_count];
- };
- };
- };
- };
- /*
- magazines
- count =>5
- underbarrel
- type 16
- count <5
- explosives
- type 512
- count <5
- throwables
- type 256
- count <5
- */
- // magazines, underbarrel, explosives, throwables, weapons, uniforms, vests, backpacks, attachments, items, headgear
- // [this,["magazines","weapons"] execVM 'crate_fncs\fnc_init_crate.sqf';
- _contentData = [];
- {
- _contentData set [count _contentData, [] call compile preprocessFileLineNumbers format["client\crate\get_%1.sqf",_x]];
- } forEach _contentNames;
- _createBox = {
- _boxn = (typeof _box) createVehicleLocal [0,0, 10000000];
- _boxn addEventHandler ["HandleDamage",{}];
- _boxn setVelocity [0,0,0];
- _boxn setPosATL [_pos select 0, _pos select 1, .5];
- _boxn setVectorDirAndUp [_dir,_up];
- _boxn setDammage 0;
- player reveal _boxn;
- };
- [] call _createBox;
- while {true} do {
- clearMagazineCargo _boxn;
- clearWeaponCargo _boxn;
- clearItemCargo _boxn;
- clearBackpackCargo _boxn;
- {
- {
- [_boxn, _x, _contentCount] call _add;
- } foreach _x;
- } foreach _contentData;
- if(_resupplyTime==0) exitWith {};
- sleep _resupplyTime;
- if(!alive _boxn) then {
- [] call _createBox;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment