#include "..\script_component.hpp" /* * Function: forge_client_medical_fnc_deductMedicalCost * Author: IDSolutions * * [Description] * Deducts the medical cost from the player's account. * * Arguments: * 0: Unit * 1: Total Cost * * Return Value: * None * * Example: * [player, 100] call forge_client_medical_fnc_deductMedicalCost; * * Public: Yes */ 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);