client/addons/medical/functions/fnc_deductMedicalCost.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

12 lines
519 B
Plaintext

#include "..\script_component.hpp"
params ["_unit", "_totalCost"];
private _preferredAccount = GETVAR(_unit,FORGE_Bank,0);
private _selectedAccount = ["FORGE_Cash", "FORGE_Bank"] select (_preferredAccount >= _totalCost);
private _accountBalance = _unit getVariable _selectedAccount;
private _newBalance = _accountBalance - _totalCost;
_unit setVariable [_selectedAccount, _newBalance, true];
[format ["Medical Services: %1 credited for treatment and recovery.", _totalCost], "blue-grey", 5] call EFUNC(misc,notify);