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

34 lines
1.1 KiB
Plaintext

#include "..\script_component.hpp"
params ["_veh"];
private _fuelNeeded = 1 - (fuel _veh);
private _fuelCost = "FUEL_COST" call BFUNC(getParamValue);
private _estimatedCost = _fuelNeeded * _fuelCost;
private _fuelAdded = 0;
private _refuelRate = 0.01;
private _refuelInterval = 0.1;
if (companyFunds < _estimatedCost) exitWith {
["Insufficient company funds for refueling.", "warning", 3] call EFUNC(misc,notify);
};
["Refueling Vehicle...", "grey", 3] call EFUNC(misc,notify);
while { fuel _veh < 0.99 && companyFunds >= (_fuelAdded * _fuelCost) } do {
_veh setFuel ((fuel _veh) + _refuelRate);
_fuelAdded = _fuelAdded + _refuelRate;
uiSleep _refuelInterval;
};
private _totalCost = _fuelAdded * _fuelCost;
private _formattedTotalCost = (_totalCost) call EFUNC(misc,formatNumber);
private _formattedFuelAdded = (_fuelAdded) toFixed 2;
["deduct", _totalCost] remoteExecCall ["forge_server_money_fnc_handleFunds", 2];
[format ["VEHICLE REFUELED:
<br/>Fuel Added: %1
<br/>Total Cost: $%2
<br/>Billed to SOF PMC Group.", _formattedFuelAdded, _formattedTotalCost], "blue-grey", 5] call EFUNC(misc,notify);