2017-04-01 14:02:25 +00:00
|
|
|
/*
|
|
|
|
Author: [Ignatz] He-Man
|
|
|
|
|
|
|
|
Contributors: Aaron Clark - EpochMod.com
|
|
|
|
|
|
|
|
Description:
|
|
|
|
Rearm 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_Rearm.sqf
|
|
|
|
*/
|
|
|
|
|
2017-05-02 13:28:52 +00:00
|
|
|
//[[[cog import generate_private_arrays ]]]
|
|
|
|
private ["_line","_magname","_vehName","_vehtype"];
|
|
|
|
//[[[end]]]
|
2017-03-26 18:15:24 +00:00
|
|
|
params ['_vehicle','_ammotype','_turret','_reloagmags','_ammocount','_costs'];
|
2017-04-01 14:02:25 +00:00
|
|
|
|
2017-03-26 18:15:24 +00:00
|
|
|
if (!local _vehicle) exitWith {
|
2017-04-01 14:02:25 +00:00
|
|
|
_line = 'Rearm denied - Go in as driver first!';
|
2017-05-02 13:28:52 +00:00
|
|
|
[_line,5] call Epoch_message;
|
2017-03-26 18:15:24 +00:00
|
|
|
};
|
2017-04-01 14:02:25 +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:25 +00:00
|
|
|
_line = format ['You need %1 Crypto to Rearm %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 removeMagazinesTurret [_ammotype,_turret];
|
|
|
|
for '_i' from 1 to _reloagmags do {
|
|
|
|
_vehicle addMagazineTurret [_ammotype, _turret, _ammocount];
|
2017-05-02 13:28:52 +00:00
|
|
|
};
|
2017-03-26 18:15:24 +00:00
|
|
|
_magname = getText (configFile >> 'CfgMagazines' >> _ammotype >> 'displayName');
|
|
|
|
if (_magname isequalto '') then {
|
|
|
|
_magname = _ammotype;
|
|
|
|
};
|
2017-04-01 14:02:25 +00:00
|
|
|
_line = format ['%1 rearmed with %2', _vehName, _magname];
|
2017-05-02 13:28:52 +00:00
|
|
|
[_line,5] call Epoch_message;
|