client/addons/bank/functions/fnc_withdraw.sqf
Jacob Schmidt c6daf95415
All checks were successful
Build / Build (push) Successful in 53s
Initial Repo Setup
2025-01-01 14:35:12 -06:00

28 lines
1000 B
Plaintext

#include "..\script_component.hpp"
private _display = findDisplay IDD_BANKDIALOG;
private _input = _display displayCtrl IDC_AMOUNTINPUT;
private _amount = parseNumber (ctrlText _input);
// 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 <= _bank) then {
_bank = _bank - _amount;
_cash = _cash + _amount;
// player setVariable ["FORGE_Bank", _bank];
// player setVariable ["FORGE_Cash", _cash];
SETPVAR(player,FORGE_Bank,_bank);
SETPVAR(player,FORGE_Cash,_cash);
// [] call forge_client_bank_fnc_refresh;
[] call FUNC(refresh);
// hint "Money withdrawn successfully";
[format ["Money withdrawn successfully"], "info", 3, "right"] call EFUNC(misc,notify);
} else {
// hint "Invalid amount";
[format ["Invalid amount"], "warning", 3, "right"] call EFUNC(misc,notify);
};