mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-05-15 07:03:21 +03:00
Organize files a bit and removed non source pbo's
This commit is contained in:
56
SQF/dayz_code/actions/player_loadCrate.sqf
Normal file
56
SQF/dayz_code/actions/player_loadCrate.sqf
Normal file
@@ -0,0 +1,56 @@
|
||||
private ["_dir","_classname","_box","_location","_item","_config","_create_raw","_create","_qty","_type","_hasCrate","_hasTool"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Open Crate already in progress." , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
|
||||
_hasTool = "ItemCrowbar" in items player;
|
||||
if(!_hasTool) exitWith {
|
||||
cutText ["You need a crowbar to open this.", "PLAIN DOWN"];
|
||||
TradeInprogress = false;
|
||||
};
|
||||
|
||||
_item = _this;
|
||||
_hasCrate = _item in magazines player;
|
||||
if (!_hasCrate) then {
|
||||
cutText ["Missing supply crate.", "PLAIN DOWN"];
|
||||
TradeInprogress = false;
|
||||
};
|
||||
|
||||
_config = configFile >> "CfgMagazines" >> _item;
|
||||
_create_raw = getArray (_config >> "ItemActions" >> "CreateMags" >> "output");
|
||||
_create = _create_raw select 0;
|
||||
_qty = _create_raw select 1;
|
||||
_type = _create_raw select 2;
|
||||
|
||||
_location = player modeltoworld [0,0.3,0];
|
||||
if ((_location select 2) < 0) then {
|
||||
_location set [2,0];
|
||||
};
|
||||
|
||||
player removeMagazine _item;
|
||||
_dir = getDir player;
|
||||
_classname = "WeaponHolder";
|
||||
|
||||
// Change to optional wait to complete
|
||||
player playActionNow "Medic";
|
||||
sleep 6;
|
||||
|
||||
_box = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
|
||||
_box setDir _dir;
|
||||
|
||||
// Fill box with Items from config.
|
||||
if(_type == "magazine") then {
|
||||
_box addMagazineCargoGlobal [_create,_qty];
|
||||
};
|
||||
if(_type == "weapon") then {
|
||||
_box addWeaponCargoGlobal [_create,_qty];
|
||||
};
|
||||
if(_type == "backpack") then {
|
||||
_box addBackpackCargoGlobal [_create,_qty];
|
||||
};
|
||||
|
||||
player reveal _box;
|
||||
|
||||
cutText ["Opened supply crate.", "PLAIN DOWN"];
|
||||
|
||||
TradeInprogress = false;
|
||||
Reference in New Issue
Block a user