#include "..\script_component.hpp"

private _amount = parseNumber (ctrlText IDC_AMOUNTINPUT);
// private _bank = player getVariable ["FORGE_Bank", 0];
// private _cash = player getVariable ["FORGE_Cash", 0];
private _bank = GETVAR(player,FORGE_Bank,0);
private _cash = GETVAR(player,FORGE_Cash,0);

if (_amount > 0 && _amount <= _cash) then {
    _cash = _cash - _amount;
    _bank = _bank + _amount;

    // player setVariable ["FORGE_Bank", _bank, true];
    // player setVariable ["FORGE_Cash", _cash, true];
    SETPVAR(player,FORGE_Bank,_bank);
    SETPVAR(player,FORGE_Cash,_cash);

    // [] call forge_client_bank_fnc_refresh;
    [] call FUNC(refresh);
    hint "Money deposited successfully";
} else {
    hint "Invalid amount";
};