Jump to content
  • 0

Coins Epoch 1.0.6 Safes


Airwaves Man

Question

Hey guys,

I have some trouble with my coins and the safes after unlocking. My coins system SC 3.0 works without problems so far. Store coins on normal items and vehicles works well. Only the display part for the safe/ lockbox coins is not as intened.

What I know so far:

- coins were stored correctly, the DB value is in the right column

- coins were saved right after restart

- after restart, the locked safe has the right coin value and I can display it

- after unlocking the safe, the coin value it 0, the DB coins value is still ok

 

So it seems the problem is when the locked safe gets unlocked.

I tried to get it working where the gear from the safes and the lockboxes are handled (server_handleSafeGear.sqf) but without success. Is anybody here who can give me a hint where I have to set the variable?

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
1 hour ago, A Man said:

Hey guys,

I have some trouble with my coins and the safes after unlocking. My coins system SC 3.0 works without problems so far. Store coins on normal items and vehicles works well. Only the display part for the safe/ lockbox coins is not as intened.

What I know so far:

- coins were stored correctly, the DB value is in the right column

- coins were saved right after restart

- after restart, the locked safe has the right coin value and I can display it

- after unlocking the safe, the coin value it 0, the DB coins value is still ok

 

So it seems the problem is when the locked safe gets unlocked.

I tried to get it working where the gear from the safes and the lockboxes are handled (server_handleSafeGear.sqf) but without success. Is anybody here who can give me a hint where I have to set the variable?

 

Hey,

oiad from github here, this is what I did to my server_handleSafeGear:

	case 0: { //Unlocking
		_unlockedClass = getText (configFile >> "CfgVehicles" >> _type >> "unlockedClass");
		_weapons = _obj getVariable ["WeaponCargo",[]];
		_magazines = _obj getVariable ["MagazineCargo",[]];
		_backpacks = _obj getVariable ["BackpackCargo",[]];
		if (Z_singleCurrency) then {_coins = _obj getVariable [Z_MoneyVariable,0];};
		
		// Create new unlocked safe, then delete old locked safe
		//_holder = createVehicle [_unlockedClass,_pos,[],0,"CAN_COLLIDE"];
		_holder = _unlockedClass createVehicle [0,0,0];
		_holder setDir _dir;
		_holder setVariable ["memDir",_dir,true];
		_holder setVectorDirAndUp _vector;
		_holder setPosATL _pos;
		_holder setVariable ["CharacterID",_charID,true];
		_holder setVariable ["ObjectID",_objectID,true];
		_holder setVariable ["ObjectUID",_objectUID,true];
		_holder setVariable ["OEMPos",_pos,true];
		if (DZE_permanentPlot) then {_holder setVariable ["ownerPUID",_ownerID,true];};
		if (Z_singleCurrency) then {_holder setVariable [Z_MoneyVariable,_coins,true];};
		deleteVehicle _obj;
		
		[_weapons,_magazines,_backpacks,_holder] call server_addCargo;
	};
	case 1: { //Locking
		_lockedClass = getText (configFile >> "CfgVehicles" >> _type >> "lockedClass");
	
		// Save to database (also happens if a player is within 10m in server_playerSync and server_onPlayerDisconnect)
		[_obj,"gear"] call server_updateObject;
		_weapons = getWeaponCargo _obj;
		_magazines = getMagazineCargo _obj;
		_backpacks = getBackpackCargo _obj;
		if (Z_singleCurrency) then {_coins = _obj getVariable [Z_MoneyVariable,0];};
		
		// Create new locked safe, then delete old unlocked safe
		//_holder = createVehicle [_lockedClass,_pos,[],0,"CAN_COLLIDE"];
		_holder = _lockedClass createVehicle [0,0,0];
		_holder setDir _dir;
		_holder setVariable ["memDir",_dir,true];
		_holder setVectorDirAndUp _vector;
		_holder setPosATL _pos;
		_holder setVariable ["CharacterID",_charID,true];
		_holder setVariable ["ObjectID",_objectID,true];
		_holder setVariable ["ObjectUID",_objectUID,true];
		_holder setVariable ["OEMPos",_pos,true];
		if (DZE_permanentPlot) then {_holder setVariable ["ownerPUID",_ownerID,true];};
		if (Z_singleCurrency) then {_holder setVariable [Z_MoneyVariable,_coins,true];};
		deleteVehicle _obj;
		
		// Local setVariable gear onto new locked safe for easy access on next unlock
		// Do not send big arrays over network! Only server needs these
		_holder setVariable ["WeaponCargo",_weapons,false];
		_holder setVariable ["MagazineCargo",_magazines,false];
		_holder setVariable ["BackpackCargo",_backpacks,false];
	};

Just need to put _coins into the private array at the top and you're good to go.

Link to comment
Share on other sites

  • 0

Forgive me as I'm on my phone at work.

I had to add both the lockable and unlockable class names to dze_moneystorage or whatever that var is then make fn_selfactions only access the unlocked class name.

this variable: 

DZE_MoneyStorageClasses = DZE_LockableStorage;

and this is my fn_selfActions part:

	if ((_typeOfCursorTarget in DZE_UnLockedStorage) && {player distance _cursorTarget < 5}) then {
		if (s_bank_dialog < 0) then {
			s_bank_dialog = player addAction [format ["<t color=""#0096FF"">Access bank</t>"], "scripts\zsc\bankDialog.sqf",_cursorTarget, 1, true, true];
		};
	} else {
     	player removeAction s_bank_dialog;
		s_bank_dialog = -1;
	};

This fixed all my DB saving issues since I think the problem was server update not forcesaving the coins, unless I'm not understanding your problem properly.

 

Happy to help more when I'm home from work (8-9 hours)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...