server/addons/money/functions/fnc_handleMoney.sqf
Jacob Schmidt 48e3e15f71
Some checks failed
Build / Build (push) Failing after 51s
Initial Repo Setup
2025-01-01 14:30:34 -06:00

39 lines
1.2 KiB
Plaintext

#include "..\script_component.hpp"
params ["_condition", "_type", "_amount", "_player"];
private _newBank = 0;
private _newCash = 0;
private _bank = _player getVariable ["FORGE_Bank", 0];
private _cash = _player getVariable ["FORGE_Cash", 0];
private _uid = getPlayerUID _player;
switch (_condition) do {
case "advance": {
if (_type == "Cash") then {
_newCash = _cash + _amount;
_player setVariable ["Cash", _newCash, true];
["hsetid", _uid, "Cash", -1, [_newCash], "", false] call dragonfly_db_fnc_addTask;
};
if (_type == "Bank") then {
_newBank = _bank + _amount;
_player setVariable ["FORGE_Bank", _newBank, true];
["hsetid", _uid, "FORGE_Bank", -1, [_newBank], "", false] call dragonfly_db_fnc_addTask;
};
};
case "deduct": {
if (_type == "Cash") then {
_newCash = _cash - _amount;
_player setVariable ["FORGE_Cash", _newCash, true];
["hsetid", _uid, "Cash", -1, [_newCash], "", false] call dragonfly_db_fnc_addTask;
};
if (_type == "Bank") then {
_newBank = _bank - _amount;
_player setVariable ["FORGE_Bank", _newBank, true];
["hsetid", _uid, "FORGE_Bank", -1, [_newBank], "", false] call dragonfly_db_fnc_addTask;
};
};
};