English Deposit all & Take all in a vehicle

  • Auteur de la discussion Auteur de la discussion ToMA3
  • Date de début Date de début

ToMA3

User
24/4/20
164
18
41
1 100
Double click on an item from the virtual inventory or of the trunk of a vehicle, will transfer the maximum possible item !
Author : Joaquine
Installation : EASY
___​

Installation:

In your core/vehicle/fn_vehInventory.sqf add at the end of the file :
Code:
_pInv ctrlAddEventHandler ["LBDblClick", {
    params ["_control", "_selectedIndex"];
    disableSerialization;
    private _item = (_control lbData _selectedIndex);
    private _items_player = format["life_inv_%1", _item];
    _items_player = call compile format["%1", _items_player];
    private _weight_veh = [life_trunk_vehicle] call life_fnc_vehicleWeight;
    _diff = [_item,_items_player,(_weight_veh # 1),(_weight_veh # 0) ] call life_fnc_calWeightDiff;
    if (_diff <= 0) then {
         ((findDisplay 3500) displayCtrl 3506) ctrlSetText "0";
         hint "You cannot deposit more items";
    } else {
        ((findDisplay 3500) displayCtrl 3506) ctrlSetText format["%1",_diff];
        [] call life_fnc_vehStoreItem;
    };
}];

_tInv ctrlAddEventHandler ["LBDblClick", {
    params ["_control", "_selectedIndex"];
    disableSerialization;
    private _item = (_control lbData _selectedIndex);
    private _index = [_item,((life_trunk_vehicle getVariable "Trunk") # 0)] call TON_fnc_index;
    if (_index isEqualTo -1) exitWith {};
    private _data = (life_trunk_vehicle getVariable "Trunk") # 0;
    private _value = ((_data # _index) # 1);
    _diff = [_item,_value,life_carryWeight,life_maxWeight] call life_fnc_calWeightDiff;
    if (_diff <= 0) then {
         ((findDisplay 3500) displayCtrl 3505) ctrlSetText "0";
            hint "You cannot retrieve more items";
    } else {
        ((findDisplay 3500) displayCtrl 3505) ctrlSetText format["%1",_diff];
        [] call life_fnc_vehTakeItem;
    };
}];
 
Dernière édition par un modérateur:
  • Like
Les réactions: IceEagle132