Jump to content
austin_medic

Problem With saving things to profileNameSpace

Recommended Posts

Alright so I got yet another issue that seems to provide no information as to what the problem is.

 

I'm trying to save some stuff to the server then have it reload that stuff when the mission restarts:

if isServer then { //only run on server
	if(time < 15) then
	{
		GV_Sand_Balance = profileNamespace getVariable ["#AUSMD#Balance",100000];
		publicVariable "GV_Sand_Balance";
		_boxes = [RS3,RS2,RS1,RSE1,RSL1,PHQ1,RS9,RS8,RS7,RSE3,RSL3,PHQ3,AUSMD_buyBox];
		_items = profileNameSpace getVariable ["#AUSMD#Boxes",[]];
		if(!(_items isEqualTo [])) then
		{
			{
				_box = _x;
				clearWeaponCargoGlobal _box;
				clearMagazineCargoGlobal _box;
				clearItemCargoGlobal _box;
				clearBackpackCargoGlobal _box;
				_subArr = _items select _forEachIndex;
				_weps = _subArr select 0;
				_wepsCount = _subArr select 1;
				_mags = _subArr select 2;
				_magsCount = _subArr select 3;
				_itemss = _subArr select 4;
				_itemsCount = _subArr select 5;
				_backpacks = _subArr select 6;
				_backpacksCount = _subArr select 7;
				{
					_box addWeaponCargoGlobal[_x,_wepsCount select _forEachIndex];
				} forEach _weps;
				{
					_box addMagazineCargoGlobal[_x,_magsCount select _forEachIndex];
				} forEach _mags;
				{
					_box addItemCargoGlobal[_x,_itemsCount select _forEachIndex];
				} forEach _itemss;
				{
					_box addBackpackCargoGlobal[_x,_backpacksCount select _forEachIndex];
				} forEach _backpacks;
			} forEach _items;	
		};
		_vehicleToSpawn = profileNameSpace getVariable ["#AUSMD#Vehicles",[]];
		if(!(_vehicleToSpawn isEqualTo [])) then
		{
			{
				_veh = _x select 0;
				_pos = _x select 1;
				_vehicle = _veh createVehicle _pos;
			} forEach _vehicleToSpawn;
		};
	};
	
	[] spawn
	{
		_boxes = [RS3,RS2,RS1,RSE1,RSL1,PHQ1,RS9,RS8,RS7,RSE3,RSL3,PHQ3,AUSMD_buyBox];
		while{true} do
		{
			sleep 5;
			profileNameSpace setVariable ["#AUSMD#Balance",GV_Sand_Balance];
			//ammo boxes
			_saveArray = [];
			
			{
				_guns = getWeaponCargo _x;
				_mags = getMagazineCargo _x;
				_items = getItemCargo _x;
				_backpacks = getBackpackCargo _x;
				_subArray = _guns + _mags + _items + _backpacks;
				_saveArray set [count _saveArray,_subArray];
			} forEach _boxes;
				
			profileNameSpace setVariable ["#AUSMD#Boxes",_saveArray];
			
			//vehicles at base
			_vehicles = nearestObjects[(getMarkerPos "HQ"),["Car_F","Air"],60];
			
			_vehicleArray = [];
			
			{
				if(!(_x getVariable "AUSMD_doNotAdd") && alive _x) then
				{
					_vehicleArray set[count _vehicleArray,[(typeOf(_x)),(getPos _x)];
				};
			} forEach _vehicles;
			
			profileNameSpace setVariable ["#AUSMD#Vehicles",_vehicleArray];
			
			saveProfileNamespace;
		};
	};
};

My issue is that anything other than the balance variable don't get saved, or even get written for that matter. There is no errors provided and nothing in rpt, what am I doing wrong?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×