Advertisement
TomMack

loadAmmobox.sqf

Jun 12th, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.50 KB | None | 0 0
  1. /*
  2.     File:       saveVehicles.sqf
  3.     Author:     xBowBii (aka xbwb)
  4.    
  5.     Modified by Tom Mack - 13/06/17
  6.    
  7. */
  8.  
  9. _vehicles = profileNamespace getVariable ["SURV_Vehicles",[]];
  10.  
  11. {
  12.  
  13.     private ["_log","_vtype","_vpos","_vdir","_vdam","_veh","_vFuel","_vWeap","_vMags","_vItems"]; //added "_vItems" to find item types
  14.  
  15.     _vType = _x select 0;
  16.     _vPos  = _x select 1;
  17.     _vDir  = _x select 2;
  18.     _vDam  = _x select 3;
  19.     _vVar1 = _x select 4;
  20.     _vFuel = _x select 5;
  21.     _vWeap = _x select 6;
  22.     _vMags = _x select 7;
  23.     _hitp  = _x select 8;
  24.     _vItems = _x select 9; //added "_vItems"
  25.  
  26.     //"extLOG" callExtension format["0:VehicleLogging: %1 at %2, with dmg %3. Fuel is %4, and Cargo is %5 && %6",_vType,_vPos,_vDam,_vFuel,_vWeap,_vMags,_vItems]; //added "_vItems"
  27.  
  28.     if (_vDam == 1) exitWith {/* useless to spawn it */};
  29.  
  30.     _veh = createVehicle [_vType, _vPos, [], 0, "CAN_COLLIDE"];
  31.     _veh setDir _vDir;
  32.     _veh setDamage _vDam;
  33.  
  34.     removeAllWeapons _veh;
  35.     removeAllItems _veh;
  36.    
  37.     //added to remove existing ammobox content.
  38.     clearMagazineCargo _veh;
  39.     clearWeaponCargo _veh;
  40.     clearItemCargo _veh;
  41.  
  42.     _veh setVariable ["myCVar",_vVar1,true];
  43.  
  44.     {
  45.         _veh setHitPointDamage [(_x select 0), (_x select 1)];
  46.     } forEach _hitp;
  47.  
  48.     _veh setFuel _vFuel;
  49.  
  50.     {
  51.         _veh addWeaponCargoGlobal [_x,1];
  52.     } forEach _vWeap;
  53.    
  54.     {
  55.         _veh addMagazineCargoGlobal [_x,1];
  56.     } forEach _vMags;
  57.    
  58.     //added to add saved items.
  59.     {
  60.         _veh addItemCargoGlobal [_x,1];
  61.     } forEach _vItems;
  62.  
  63. } forEach _vehicles;
  64.  
  65. sleep 20;
  66. SURV_VehiclesLoaded = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement