player2_dz

Untitled

Feb 13th, 2015
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.18 KB | None | 0 0
  1. _object_gold = {
  2.     private["_objGoldVar","_key","_d","_p2q","_p2a"];
  3.     _d = P2D_H;
  4.  
  5.     _objGoldVar = _object getVariable ["ZombZGold", 0];
  6.     if (isNil "_objGoldVar") then { _objGoldVar = 0; };
  7.     if (!(typeName _objGoldVar == typeName 0)) then { _objGoldVar = 0; };
  8.     _p2q = nil; _p2q = false;
  9.    
  10.     if (_d) then { diag_log(format["HIVE:   P2H_LGSR@Start: %1 ", (P2H_LGSR)]); };
  11.  
  12.     {
  13.          if (_x select 1 == _object) then {
  14.             if ((_x select 2) == _objGoldVar && ((diag_tickTime - (_x select 0)) < 120)) then {
  15.                 _p2q = true;
  16.                 if (_d) then { diag_log("HIVE: Data Ignored (Data Same as Recent(120s) send):_x: " + str _x); };
  17.             };
  18.         };
  19.     } forEach P2H_LGSR;
  20.  
  21.  
  22.  
  23.     if (_p2q) exitWith { _p2q = nil; }; _p2q = nil;
  24.  
  25.     //last gold save request array: [[diag_tickTime, Object, LastSavedObjectGold],...]
  26.     _p2a = false;
  27.  
  28.     {
  29.          if (_x select 1 == _object) then {
  30.             _p2a = true;
  31.             P2H_LGSR set [_foreachindex, [diag_tickTime,_object,_objGoldVar]];
  32.             if (_d) then { diag_log(format["HIVE:   P2H_LGSR@UdateExisting: %1 ", (P2H_LGSR)]); };
  33.         };
  34.         if (((diag_tickTime - (_x select 0)) > 120)) then {
  35.             P2H_LGSR set [_foreachindex, -1];
  36.             P2H_LGSR = P2H_LGSR - [-1];
  37.             if (_d) then { diag_log(format["HIVE:   P2H_LGSR@RemoveOld: %1 ", (P2H_LGSR)]); };
  38.         };
  39.     } forEach P2H_LGSR;
  40.  
  41.     if (!_p2a) then {
  42.         P2H_LGSR set [count P2H_LGSR, [diag_tickTime,_object,_objGoldVar]];
  43.         if (_d) then { diag_log(format["HIVE:   P2H_LGSR@AddNew:    %1 ", (P2H_LGSR)]); };
  44.  
  45.     };
  46.  
  47.     if (_d) then { diag_log(format["HIVE:   P2H_LGSR@End:   %1 ", (P2H_LGSR)]); };
  48.  
  49.     //0 to be used in future for...something...ATMs? LocalBoxes?! What?!
  50.     _objGoldVar = [_objGoldVar,0];
  51.  
  52.     if (_objectID == "0") then {
  53.         _key = format["CHILD:323:%1:%2:",_uid,_objGoldVar];
  54.         //diag_log("P2DEBUG: _object_gold by UID");
  55.         if (_d) then { diag_log("HIVE:byUID: Data Sent:" + str _key); };
  56.     } else {
  57.         _key = format["CHILD:322:%1:%2:",_objectID,_objGoldVar];
  58.         //diag_log("P2DEBUG: _object_gold by objectID");
  59.         if (_d) then { diag_log("HIVE:byID: Data Sent:" + str _key); };
  60.     };
  61.  
  62.     _key call server_hiveWrite;
  63.  
  64.     if ((_objGoldVar select 0) > 0) then {
  65.         [_object,true] call fnc_removeExtraBars;
  66.     } else {
  67.         [_object,false] call fnc_removeExtraBars;
  68.     };
  69. }
Advertisement
Add Comment
Please, Sign In to add comment