Advertisement
Halvhjearne

service_point_rearm.sqf

Apr 15th, 2015
1,684
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.89 KB | None | 0 0
  1. // Vehicle Service Point (Rearm) by Axe Cop
  2. //reworked for a3 epoch by Halv
  3.  
  4. private ["_vehicle","_args","_servicePoint","_costs","_magazineCount","_weapon","_type","_name","_weaponType","_weaponName","_turret","_magazines","_ammo"];
  5.  
  6. _vehicle = _this select 0;
  7. _args = _this select 3;
  8. _servicePoint = _args select 0;
  9. _costs = _args select 1;
  10. _weapon = _args select 2;
  11. _type = typeOf _vehicle;
  12. _name = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
  13. _weaponName = _weapon select 0;
  14. _ammoClass = _weapon select 1;
  15. _ammoName = _weapon select 2;
  16. _ammoMAX = _weapon select 3;
  17. _ammoMIN = _weapon select 4;
  18. _turret = _weapon select 5;
  19.  
  20. if (!local _vehicle) exitWith {cutText [format["%2 is not local to %1 - Re-Arm Denied!",name player, _name], "PLAIN DOWN"]; diag_log format["Error: called service_point_rearm.sqf with non-local vehicle: %1", _vehicle] };
  21. if(count (crew _vehicle) > 1) exitWith {cutText ["All Passengers Must Exit Vehicle - Re-Arm Denied!", "PLAIN DOWN"];};
  22. if (EPOCH_playerCrypto <_costs && isHalvTradeEnabled) exitWith {cutText [format["You need %1 Crypto to re-arm %2", _costs,_name], "PLAIN DOWN"];};
  23. _currentmags = magazines _vehicle;
  24. _magscount = count _currentmags;
  25. _ammocount = {_ammoClass == _x}count _currentmags;
  26. if(_magscount > _ammoMAX)exitWith{cutText [format["You already have %1 magazine(s) in %2",_magscount,_weaponName], "PLAIN DOWN"];};
  27. if(_ammocount > _ammoMIN)exitWith{cutText [format["You already have %1 magazine(s) of %2 in %3\nTotal of %4 magazine(s)",_ammocount,_ammoName,_weaponName,_magscount], "PLAIN DOWN"];};
  28.  
  29. if(_costs > 0 && isHalvTradeEnabled)then{
  30.     HALV_takegive = [player,(_costs*-1),true];
  31.     publicVariableServer "HALV_takegive";
  32. };
  33.  
  34. //EPOCH_playerCrypto = EPOCH_playerCrypto - _costs ;
  35.  
  36. // add a magazines
  37. _vehicle addMagazineTurret [_ammoClass, _turret];
  38.  
  39. cutText [format["%1 of %2 Rearmed", _weaponName, _name], "PLAIN DOWN"];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement