Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- playerLoadTawLoadout = {
- private _target = player;
- private _virtualArsenalLoadouts = profilenamespace getvariable ["bis_fnc_saveInventory_data", nil];
- if (!isNil {_virtualArsenalLoadouts}) then {
- private _targetTypeName = toLower getText(configfile >> "cfgVehicles" >> typeof _target >> "DisplayName");
- private _targetTags = ["taw", "wood"];
- _targetTags append (_targetTypeName splitString " ");
- if(_targetTypeName == "squad leader") then {
- _targetTags append ["sl", "pl"];
- };
- if(_targetTypeName == "team leader") then {
- _targetTags append ["fl"];
- };
- if(_targetTypeName == "combat life saver") then {
- _targetTags append ["medic"];
- };
- if(_targetTypeName == "marksman") then {
- _targetTags append ["sniper"];
- };
- if(_targetTypeName == "engineer") then {
- _targetTags append ["repair"];
- };
- systemChat format["Looking for loadout with tags: %1", _targetTags];
- private _foundLoadoutName = "";
- private _foundLoadoutTagsMatched = 0;
- for "_i" from 0 to (count _virtualArsenalLoadouts) - 1 step 2 do {
- private _loadoutName = _virtualArsenalLoadouts select _i;
- private _loadoutNameParts = _loadoutName splitString "-.,=/ ";
- private _tagsMatched = 0;
- {
- if((toLower _x) in _targetTags) then {
- _tagsMatched = _tagsMatched + 1;
- };
- } forEach _loadoutNameParts;
- if(_tagsMatched > _foundLoadoutTagsMatched) then {
- _foundLoadoutTagsMatched = _tagsMatched;
- _foundLoadoutName = _loadoutName;
- };
- systemChat format["loadout '%1' matches %2 tags", _loadoutName, _tagsMatched];
- };
- if(_foundLoadoutName != "") then {
- systemChat format["Found loadout '%1' matches %2 tags", _foundLoadoutName, _foundLoadoutTagsMatched];
- [player, [profilenamespace, _foundLoadoutName]] call BIS_fnc_loadInventory;
- } else {
- systemChat "No loadout found";
- };
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment