2017-04-01 14:02:48 +00:00
|
|
|
/*
|
|
|
|
Author: [Ignatz] He-Man
|
|
|
|
|
|
|
|
Contributors: Aaron Clark - EpochMod.com
|
|
|
|
|
|
|
|
Description:
|
|
|
|
Refuel Vehicles for A3 Epoch
|
|
|
|
|
|
|
|
Licence:
|
|
|
|
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
|
|
|
|
|
|
|
Github:
|
|
|
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/servicepoint/EPOCH_SP_Refuel.sqf
|
|
|
|
*/
|
|
|
|
|
|
|
|
private ['_vehtype','_vehName'];
|
|
|
|
params [['_vehicle',objnull],['_args',[]]];
|
|
|
|
_args params [['_costs',0],['_updateInterval',1],['_amount',0.1]];
|
|
|
|
|
|
|
|
if (!local _vehicle) exitWith {
|
|
|
|
_line = 'Refuel denied - Go in as driver first!';
|
2017-05-02 13:28:52 +00:00
|
|
|
[_line,5] call Epoch_message;
|
2017-04-01 14:02:48 +00:00
|
|
|
};
|
|
|
|
_vehtype = typeof _vehicle;
|
|
|
|
_vehName = getText(configFile >> 'cfgVehicles' >> _vehtype >> 'displayName');
|
2017-03-26 18:15:24 +00:00
|
|
|
if (EPOCH_playerCrypto < _costs) exitWith {
|
2017-04-01 14:02:48 +00:00
|
|
|
_line = format ['You need %1 Crypto to Refuel %2', _costs,_vehName];
|
2017-05-02 13:28:52 +00:00
|
|
|
[_line,5] call Epoch_message;
|
2017-03-26 18:15:24 +00:00
|
|
|
};
|
|
|
|
if(_costs > 0)then{
|
2017-03-30 16:02:15 +00:00
|
|
|
[player,(_costs*-1),Epoch_personalToken] remoteexec ['epoch_server_paycrypto',2];
|
2017-03-26 18:15:24 +00:00
|
|
|
};
|
|
|
|
_vehicle engineOn false;
|
2017-04-01 14:02:48 +00:00
|
|
|
while {(vehicle player == _vehicle) && (local _vehicle) && (alive player)} do {
|
2017-03-26 18:15:24 +00:00
|
|
|
if (speed _vehicle > 2 || speed _vehicle < -2 ) exitWith {
|
2017-04-01 14:02:48 +00:00
|
|
|
_line = format ['Refueling of %1 stopped', _vehName];
|
2017-05-02 13:28:52 +00:00
|
|
|
[_line,5] call Epoch_message;
|
2017-03-26 18:15:24 +00:00
|
|
|
};
|
|
|
|
_vehicle setFuel ((Fuel _vehicle)+_amount);
|
|
|
|
if (Fuel _vehicle > 0.99) exitWith {
|
2017-04-01 14:02:48 +00:00
|
|
|
_line = format ['%1 Refueled', _vehName];
|
2017-05-02 13:28:52 +00:00
|
|
|
[_line,5] call Epoch_message;
|
2017-03-26 18:15:24 +00:00
|
|
|
};
|
|
|
|
uisleep _updateInterval;
|
|
|
|
};
|