Nerexis

Safe kit money limit

4 posts in this topic

BUMP: I've found that config variable 'maximumLoad'*10 determines capacity of container.

So I did:
 

class Exile_Item_SafeKit                        { quality = 4; price = 25000; maximumLoad = 50000; };

in my config.cpp, but It doesn't work.

Edited by Nerexis
1 person likes this

Share this post


Link to post
Share on other sites
Advertisement

If it's 10 x the maximum load of the container then I suspect you're not going to be able to change it as I don't believe you can change the storage levels of any container (vehicles included) without a mod that replaces the object.

If you don't get anywhere with this, I might suggest you entertain the idea of using the containers in Extended Base Mod? They store far more than a safe (therefore more money too) and most of them are lockable. Well, the shipping containers and the likes typically are anyway.

Share this post


Link to post
Share on other sites

Finaly fixed that.

Had to override two files:

ExileServer_system_money_network_putMoneyRequest.sqf
 

Spoiler

/**
 * ExileServer_system_money_network_putMoneyRequest
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_sessionID","_parameters","_objectNetID","_amount","_newContainerNetID","_player","_playerMoney","_container","_containerMoney","_nearbyPopTabs","_maximumLoad","_maximumPoptabsLoad","_maximumAmmountToAdd","_containerID"];
_sessionID = _this select 0;
_parameters = _this select 1;
_objectNetID = _parameters select 0;
_amount = _parameters select 1;
_newContainerNetID = "";
try 
{
	_player = _sessionID call ExileServer_system_session_getPlayerObject;
	if (isNull _player) then 
	{
		throw "Non-existent players cannot put money somewhere!";
	};
	if !(alive _player) then 
	{
		throw "The dead cannot put money somewhere!";
	};
	if (_amount < 1) then 
	{
		throw "Invalid money parameter!";
	};
	_playerMoney = _player getVariable ["ExileMoney", 0];
	if (_amount > _playerMoney) then 
	{
		throw "Cannot store money that this player does not have!";
	};
	_container = objectFromNetId _objectNetID;
	if (isNull _container) then 
	{
		throw "Cannot store money in non-existent container!";
	};
	if ((_player distance _container) > 10) then 
	{
		throw "Cannot store money over long distances!";
	};
	_containerMoney = _container getVariable ["ExileMoney", 0];
	if (_container isKindOf "GroundWeaponHolder") then 
	{
		_nearbyPopTabs = nearestObjects [_player, ["Exile_PopTabs"], 3];
		if (_nearbyPopTabs isEqualTo []) then
		{
			_container = createVehicle ["Exile_PopTabs", (getPos _player), [], 0, "CAN_COLLIDE"];
			_container setPosASL (getPosASL _player);
		}
		else 
		{
			_container = _nearbyPopTabs select 0;
		};
		_newContainerNetID = netID _container;
	}
	else
	{
		if!(_container isKindOf "man")then
		{
			_maximumLoad = getNumber (configFile >> "CfgVehicles" >> typeOf _container >> "maximumLoad");
			if(_maximumLoad isEqualTo 0)then
			{
				throw "Invalid container load";
			};
			_maximumPoptabsLoad = _maximumLoad * 10;
			
			diag_log format["Current container: %1",typeOf _container];
			
			if( (typeOf _container) isEqualTo "Exile_Container_Safe") then
			{
				_maximumPoptabsLoad = 500000;
			};			
			_maximumAmmountToAdd = _maximumPoptabsLoad - _containerMoney;
			if(_amount > _maximumAmmountToAdd)then
			{
				_amount = _maximumAmmountToAdd;
			};
		};
	};
	_playerMoney = _playerMoney - _amount;
	_player setVariable ["ExileMoney", _playerMoney, true];
	format["setPlayerMoney:%1:%2", _playerMoney, _player getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
	_containerMoney = _container getVariable ["ExileMoney", 0];
	_containerMoney = _containerMoney + _amount;
	_container setVariable ["ExileMoney", _containerMoney, true];
	_containerID = _container getVariable ["ExileDatabaseID", -1];
	if (_containerID > -1) then 
	{
		if ((getNumber (configFile >> "CfgVehicles" >> (typeOf _container) >> "exileContainer")) isEqualTo 1) then 
		{
			format["setContainerMoney:%1:%2", _containerMoney, _containerID] call ExileServer_system_database_query_fireAndForget;
		}
		else 
		{
			format["setVehicleMoney:%1:%2", _containerMoney, _containerID] call ExileServer_system_database_query_fireAndForget;
		};
	};
}
catch
{
	_exception call ExileServer_util_log;
};
[_sessionID, "moneyTransactionResponse", [_newContainerNetID, -1 * _amount]] call ExileServer_system_network_send_to;

 

ExileClient_gui_inventory_updatePopTabControls.sqf
 

Spoiler

/**
 * ExileClient_gui_inventory_updatePopTabControls
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_enable","_display","_containerPopTabs","_containerPopTabsString","_playerPopTabs","_playerPopTabsString","_playerPopTabsLabel","_containerPopTabsLabel","_maximumCapacity","_maximumPopTabsToPut","_maximumLoad","_maximumCapacityString","_takePopTabsInput","_maximumPopTabsToPutString","_putPopTabsInput","_takePopTabsButton","_putPopTabsButton"];
disableSerialization;
_enable = _this;
_display = findDisplay 602;
if (isNull _display) then 
{
	_display = uiNameSpace getVariable ["RscDisplayInventory", displayNull];
};
if (isNull _display) exitWith {};
if (isNull ExileClientCurrentInventoryContainer) exitWith {};
_containerPopTabs = ExileClientCurrentInventoryContainer getVariable ["ExileMoney", 0];
_containerPopTabsString = _containerPopTabs call ExileClient_util_string_exponentToString;
_playerPopTabs = player getVariable ["ExileMoney", 0];
_playerPopTabsString = _playerPopTabs call ExileClient_util_string_exponentToString;
_playerPopTabsLabel = _display displayCtrl 25001;
_playerPopTabsLabel ctrlSetStructuredText (parseText format ["<t size='1' font='RobotoCondensed' align='right'>%1<img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='1' shadow='true' /></t>", _playerPopTabsString]);
_containerPopTabsLabel = _display displayCtrl 25000;
_maximumCapacity = -1;
_maximumPopTabsToPut = _playerPopTabs;
if !(ExileClientCurrentInventoryContainer isKindOf "man") then
{
	_maximumLoad = getNumber (configFile >> "CfgVehicles" >> typeOf ExileClientCurrentInventoryContainer >> "maximumLoad");
	if (_maximumLoad > 0) then
	{
		_maximumCapacity = _maximumLoad * 10;
		if( (typeOf ExileClientCurrentInventoryContainer) isEqualTo "Exile_Container_Safe") then
		{
			_maximumCapacity = 500000;
		};
		
		_maximumPopTabsToPut = _playerPopTabs min _maximumCapacity;
	};
};
if !(_maximumCapacity isEqualTo -1) then 
{
	_maximumCapacityString = _maximumCapacity call ExileClient_util_string_exponentToString;
	_containerPopTabsLabel ctrlSetStructuredText (parseText format ["<t size='1' font='RobotoCondensed' align='right'>%1 / %2<img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='1' shadow='true' /></t>", _containerPopTabsString, _maximumCapacityString]);
}
else 
{
	_containerPopTabsLabel ctrlSetStructuredText (parseText format ["<t size='1' font='RobotoCondensed' align='right'>%1<img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='1' shadow='true' /></t>", _containerPopTabsString]);
};
_takePopTabsInput = _display displayCtrl 25002;
_takePopTabsInput ctrlSetText _containerPopTabsString;
_maximumPopTabsToPutString = _maximumPopTabsToPut call ExileClient_util_string_exponentToString;
_putPopTabsInput = _display displayCtrl 25005;
_putPopTabsInput ctrlSetText _maximumPopTabsToPutString;
_takePopTabsButton = _display displayCtrl 25003;
_takePopTabsButton ctrlEnable !ExileClientIsWaitingForInventoryMoneyTransaction;
_putPopTabsButton = _display displayCtrl 25004;
_putPopTabsButton ctrlEnable !ExileClientIsWaitingForInventoryMoneyTransaction;

 

 

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.