Advertisement
BobTheHunted

fn_SupplyDrop

Sep 14th, 2017
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.76 KB | None | 0 0
  1. // Script run to purchase supply drops from the map menu - By BobTheHunted
  2. // nul = [type,cost,side,position] call BTH_fnc_SupplyDrop
  3. // type: Classname - Type of ammobox to create
  4. // cost:--- Number - Resource cost of ammobox
  5. // call:--- Object - Player that requested the supply drop
  6. // Example: nul = ["Box_NATO_Ammo_F",150,player,(position player)] spawn BTH_fnc_SupplyDrop;
  7.  
  8. params [
  9.     ['_ammoType',"",[""]],
  10.     ['_ammoCost',0,[0]],
  11.     ['_ammoSide',resistance,[civilian]],
  12.     ['_ammoPos',[0,0,0],[[0,0,0]]]
  13. ];
  14.  
  15. if (_ammoSide == civilian) exitWith {hint "Civilians shouldn't have this you reckless fuck";};
  16.  
  17. private _p_balance = [WEST_balance , EAST_balance, GUER_balance] select ([west, east, resistance] find _ammoSide);
  18.  
  19. if (_p_balance >= _ammoCost) then {
  20.     [_ammoCost,_ammoSide,false] call BTH_fnc_HandleBalance;
  21.  
  22.     private _ammoBox = createVehicle [_ammoType, [0,0,100], [], 0, ""];
  23.     private _para = createVehicle ["B_Parachute_02_F", [0,0,125], [], 0, ""];
  24.  
  25.     _ammoBox attachTo [_para,[0,0,0]];
  26.     _ammoBox allowDamage false;
  27.     _ammoBox setDamage 0;
  28.  
  29.     _para setPosATL [(_ammoPos select 0),(_ammoPos select 1),(_ammoPos select 2) + 125];
  30.  
  31.     private _ammoSmoke = "SmokeShellRed" createVehicle (position _ammoBox);
  32.     private _ammoLight = "NVG_TargetW" createVehicle (position _ammoBox);
  33.  
  34.     _ammoSmoke attachTo [_ammoBox, [0,0,0.5]];
  35.     _ammoLight attachTo [_ammoBox, [0,0,0.5]];
  36.  
  37.     waitUntil {(getPosATL _ammoBox select 2) < 1};
  38.  
  39.     detach _ammoBox;
  40.     _ammoBox setVelocity [0,0,-5];
  41.  
  42.     sleep 0.4;
  43.  
  44.     deleteVehicle _ammoLight;
  45.  
  46.     _ammoBox setPos [(position _ammoBox) select 0, (position _ammoBox) select 1, 1];
  47.     _ammoBox setVelocity [0,0,0];
  48.     _ammoBox allowDamage true;
  49.  
  50.     hintSilent "Supplies have arrived";
  51. } else {
  52.     hint "You cannot afford that supply drop!"
  53. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement