forked from AsYetUntitled/Framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fn_loadGear.sqf
72 lines (61 loc) · 2.78 KB
/
fn_loadGear.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "..\..\script_macros.hpp"
/*
File: fn_loadGear.sqf
Author: Bryan "Tonic" Boardwine
Description:
Loads saved civilian gear, this is limited for a reason and that's balance.
*/
private ["_handle"];
private _itemArray = life_gear;
waitUntil {!(isNull (findDisplay 46))};
[] call life_fnc_stripDownPlayer;
if (_itemArray isEqualTo []) exitWith {[] call life_fnc_startupLoadout;};
_itemArray params [
"_uniform",
"_vest",
"_backpack",
"_goggles",
"_headgear",
["_items",[]],
"_prim",
"_seco",
["_uItems",[]],
["_uMags",[]],
["_bItems",[]],
["_bMags",[]],
["_vItems",[]],
["_vMags",[]],
["_pItems",[]],
["_hItems",[]],
["_yItems",[]]
];
if (!(_goggles isEqualTo "")) then {_handle = [_goggles,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
if (!(_headgear isEqualTo "")) then {_handle = [_headgear,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
if (!(_uniform isEqualTo "")) then {_handle = [_uniform,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
if (!(_vest isEqualTo "")) then {_handle = [_vest,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
if (!(_backpack isEqualTo "")) then {_handle = [_backpack,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
{_handle = [_x,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};} forEach _items;
{player addItemToUniform _x;} forEach (_uItems);
{(uniformContainer player) addItemCargoGlobal [_x,1];} forEach (_uMags);
{player addItemToVest _x;} forEach (_vItems);
{(vestContainer player) addItemCargoGlobal [_x,1];} forEach (_vMags);
{player addItemToBackpack _x;} forEach (_bItems);
{(backpackContainer player) addItemCargoGlobal [_x,1];} forEach (_bMags);
life_maxWeight = if (backpack player isEqualTo "") then {LIFE_SETTINGS(getNumber,"total_maxWeight")} else {LIFE_SETTINGS(getNumber,"total_maxWeight") + round(FETCH_CONFIG2(getNumber,"CfgVehicles",(backpack player),"maximumload") / 4)};
{
[true,(_x select 0),(_x select 1)] call life_fnc_handleInv;
} forEach (_yItems);
//Primary & Secondary (Handgun) should be added last as magazines do not automatically load into the gun.
if (!(_prim isEqualTo "")) then {_handle = [_prim,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
if (!(_seco isEqualTo "")) then {_handle = [_seco,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
{
if (!(_x isEqualTo "")) then {
player addPrimaryWeaponItem _x;
};
} forEach (_pItems);
{
if (!(_x isEqualTo "")) then {
player addHandgunItem _x;
};
} forEach (_hItems);
[] call life_fnc_playerSkins;