Jump to content
  • 0

Maintainance Doesn't Update DB


joelash

Question

Hey everyone, im currently getting my server working 100% but this is the only thing currently holding it back. I have an SQL event updating the Damage Value of the objects every 3 days, and so it should be maintained when this occurs. However when maintaining an object this isnt updated in the DB and the Damage Value stays the same and the DateStamp/LastUpdated aren't refreshed.

 

Any help on this Would be greatly appreciated.

 

RPT Log of Maintain (No Errors Shown):

17:16:14 "MAINTAIN AREA BY Joel - 10 Objects at [2314.19,15331.1,0.00195313]"

Current server_maintainArea.sqf

/* Maintain Area - written by Skaronator */
private ["_player","_name","_ObjArray","_uniqueID","_objects","_key"];
_player = _this select 0;
_option = _this select 1;
/*
1: PVDZE_maintainArea = [player,1,_target];
2: PVDZE_maintainArea = [player,2,_object];
*/
_targetObj = _this select 2;

if (_option == 1) then {
	_objects = nearestObjects [_targetObj, DZE_maintainClasses, DZE_maintainRange];
	{
		if (damage _x >= DZE_DamageBeforeMaint) then {
			_objectID = _x getVariable ["ObjectID","0"];
			if (_objectID == "0") then {
				_objectUID = _x getVariable ["ObjectUID","0"];
				if (_objectUID != "0") then {
					_x setDamage 0;
					_key = format["CHILD:397:%1:", _objectUID]; // use UID if not "0" && ID is "0"
					_data = "HiveExt" callExtension _key;
				};
			} else {
				_x setDamage 0;
				_key = format["CHILD:396:%1:", _objectID]; //Use ID instead of UID because ID is shorter
				_data = "HiveExt" callExtension _key;
			};
		};
	} count _objects;
	_name = if (alive _player) then { name _player; } else { "Dead Player"; };
	diag_log format ["MAINTAIN AREA BY %1 - %2 Objects at %3", _name, count _objects, (getPosATL _player)];
};
if (_option == 2) then {
	if (damage _targetObj >= DZE_DamageBeforeMaint) then {
		_objectID = _targetObj getVariable ["ObjectID","0"];
		if (_objectID == "0") then {
			_objectUID = _targetObj getVariable ["ObjectUID","0"];
			if (_objectUID != "0") then {
				_targetObj setDamage 0;
				_key = format["CHILD:397:%1:", _objectUID]; // use UID if not "0" && ID is "0"
				_data = "HiveExt" callExtension _key;
			};
		} else {
			_targetObj setDamage 0;
			_key = format["CHILD:396:%1:", _objectID]; //Use ID instead of UID because ID is shorter
			_data = "HiveExt" callExtension _key;
			
		};
	};
};

If there are any newer versions of this file fixing this issue, please respond :)

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

 

 private ["_newWealth","_missing","_missingQty","_proceed","_itemIn","_countIn","_target","_objectClasses","_range","_objects","_requirements","_count","_cost","_option"];

 
if (DZE_ActionInProgress) exitWith { cutText [(localize "STR_EPOCH_ACTIONS_2") , "PLAIN DOWN"]; };
 
DZE_ActionInProgress = true;
 
player removeAction s_player_maintain_area;
s_player_maintain_area = 1;
player removeAction s_player_maintain_area_preview;
s_player_maintain_area_preview = 1;
 
_target = cursorTarget;
_objectClasses = DZE_maintainClasses;
_range = DZE_maintainRange;
_objects = nearestObjects [_target, _objectClasses, _range];
_objects_filtered = [];
 
{
    if (damage _x >= DZE_DamageBeforeMaint) then {
        _objects_filtered set [count _objects_filtered, _x];
   };
} count _objects;
 
_objects = _objects_filtered;
_count = count _objects;
 
if (_count == 0) exitWith {
cutText [format[(localize "STR_EPOCH_ACTIONS_22"), _count], "PLAIN DOWN"];
DZE_ActionInProgress = false;
s_player_maintain_area = -1;
s_player_maintain_area_preview = -1;
};
 
_requirements = [];
 
switch true do {
case (_count <= 10): {_requirements = [[CurrencyName,10000]]};
case (_count <= 20): {_requirements = [[CurrencyName,30000]]};
case (_count <= 35): {_requirements = [[CurrencyName,40000]]};
case (_count <= 50): {_requirements = [[CurrencyName,50000]]};
case (_count <= 75): {_requirements = [[CurrencyName,90000]]};
case (_count <= 100): {_requirements = [[CurrencyName,100000]]};
case (_count <= 175): {_requirements = [[CurrencyName,200000]]};
case (_count <= 250): {_requirements = [[CurrencyName,300000]]};
case (_count <= 325): {_requirements = [[CurrencyName,400000]]};
case (_count <= 400): {_requirements = [[CurrencyName,500000]]};
case (_count <= 475): {_requirements = [[CurrencyName,600000]]};
case (_count <= 550): {_requirements = [[CurrencyName,700000]]};
case (_count <= 625): {_requirements = [[CurrencyName,800000]]};
case (_count > 625):  {_requirements = [[CurrencyName,900000]]};
};
 
_option = _this select 3;
 
switch _option do {
 
case "maintain": {
 
_wealth = player getVariable["headShots",0];
_missing = "";
_missingQty = 0;
_proceed = true;
 
{
_itemIn = _x select 0;
_countIn = _x select 1;
if (_wealth < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _wealth); _proceed = false;  };
} count _requirements;
 
if (_proceed) then {
 
_newWealth = (_wealth - _countIn);
 
player playActionNow "Medic";
[player,_range,true,(getPosATL player)] spawn player_alertZombies;
 
player setVariable["headShots",_newWealth,true];
 
PVDZE_plr_Save = [player,(magazines player),true,true];
publicVariableServer "PVDZE_plr_Save";
 
PVDZE_maintainArea = [player,1,_target];
publicVariableServer "PVDZE_maintainArea";
 
cutText [format[(localize "STR_EPOCH_ACTIONS_4"), _count], "PLAIN DOWN", 5];
            
} else {
 
cutText [format[(localize "STR_EPOCH_ACTIONS_6"), _missingQty, CurrencyName], "PLAIN DOWN"];
 
};
};
 
case "preview": {
 
_cost = "";
 
{
_itemIn = _x select 0;
_countIn = _x select 1;
if (_cost != "") then {
_cost = _cost + " and ";
};
_cost = _cost + (str(_countIn) + " " + CurrencyName);
} count _requirements;
 
cutText [format[(localize "STR_EPOCH_ACTIONS_7"), _count, _cost], "PLAIN DOWN"];
 
};
};
 
DZE_ActionInProgress = false;
s_player_maintain_area = -1;
s_player_maintain_area_preview = -1;

This is my

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...