player2_dz

Untitled

Feb 9th, 2015
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.79 KB | None | 0 0
  1. p2GoldFlashing = nil;
  2. p2GoldRunTime = nil;
  3.  
  4. fnc_p2flashGold = {
  5.     private["_in","_rt","_cl","_am"];
  6.     disableSerialization;
  7.     _in = nil;
  8.     _rt = 1.5;
  9.  
  10.     _in = _this;
  11.     if (isNil '_in') exitWith {p2GoldFlashing = nil; p2GoldRunTime = nil;};
  12.     if (typeName _in != "ARRAY") exitWith {p2GoldFlashing = nil; p2GoldRunTime = nil;};
  13.  
  14.     _cl = _in select 0;
  15.     _am = _in select 1;
  16.     if (typeName _cl != "BOOL") exitWith {p2GoldFlashing = nil; p2GoldRunTime = nil;};
  17.     if (typeName _am != "SCALAR") exitWith {p2GoldFlashing = nil; p2GoldRunTime = nil;};
  18.  
  19.     if (isNil 'p2GoldFlashing') then { if (_cl) then { p2GoldFlashing = false; } else { p2GoldFlashing = true }; };
  20.     if (isNil 'p2GoldRunTime') then { p2GoldRunTime = (_rt * 2) };
  21.  
  22.     if (str p2GoldFlashing == str _cl) then {
  23.         if (!isNil 'p2GF_R') then { terminate p2GF_R }; if (!isNil 'p2GF_G') then { terminate p2GF_G };
  24.     } else {
  25.         uiSleep (_rt / 2);  
  26.         if (!isNil 'p2GF_R') then { terminate p2GF_R }; if (!isNil 'p2GF_G') then { terminate p2GF_G };
  27.         if (isNil 'p2GoldRunTime') then { p2GoldRunTime = (_rt * 2) };
  28.         if (isNil 'p2GoldFlashing') then { if (_cl) then { p2GoldFlashing = false; } else { p2GoldFlashing = true }; };
  29.     };
  30.  
  31.     p2GoldFlashing = _cl;
  32.     if (_cl) then {
  33.         p2GF_R = [_rt,_am] spawn {
  34.             private["_rt","_am","_tx"];
  35.             _rt = _this select 0;
  36.             _am = _this select 1;
  37.  
  38.             for "_i" from 0 to p2GoldRunTime do {
  39.                 _tx = ctrlText ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290);
  40.                 for "_j" from 1 to 10 do {
  41.                     ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetStructuredText parseText("<t align='right'>" + str _am + "</t>");
  42.                     ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetTextColor [1,0,0,1];
  43.                     uiSleep 0.01;
  44.                 };
  45.                 ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetStructuredText parseText("<t align='right'>" + _tx + "</t>");
  46.                 ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetTextColor [0.8784,0.8471,0.651,1];
  47.                 uiSleep 0.40;
  48.             };
  49.  
  50.             p2GoldFlashing = nil;
  51.             p2GoldRunTime = nil;
  52.         };
  53.  
  54.     } else {
  55.         p2GF_G = [_rt,_am] spawn {
  56.             private["_rt","_am","_tx"];
  57.             _rt = _this select 0;
  58.             _am = _this select 1;
  59.  
  60.             for "_i" from 0 to p2GoldRunTime do {
  61.                 _tx = ctrlText ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290);
  62.                 for "_j" from 1 to 10 do {
  63.                     ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetStructuredText parseText("<t align='right'>+" + str _am + "</t>");
  64.                     ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetTextColor [0,1,0,1];
  65.                     uiSleep 0.01;
  66.                 };
  67.                 ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetStructuredText parseText("<t align='right'>" + _tx + "</t>");
  68.                 ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetTextColor [0.8784,0.8471,0.651,1];
  69.                 uiSleep 0.40;
  70.             };
  71.  
  72.             p2GoldFlashing = nil;
  73.             p2GoldRunTime = nil;
  74.         };
  75.     };
  76. };  
  77.  
  78. [] spawn {
  79.     private["_p2o","_p2on","_p2n","_p2nn","_p2pm","_di"];
  80.     disableSerialization;
  81.     while {true} do {
  82.         _di = uiNamespace getVariable 'p2GoldUI';
  83.         if (!isNil "_di") then {
  84.             if (isNil 'p2GoldFlashing') then {
  85.                 _p2o = ctrlText ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290);
  86.                 uiSleep 0.0333;
  87.                 _p2n = ctrlText ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290);
  88.  
  89.                 if (_p2o != _p2n) then {
  90.                     _p2on = parseNumber _p2o;
  91.                     _p2nn = parseNumber _p2n;
  92.                     _p2pm = 0;
  93.                     if (_p2on < _p2nn) then {
  94.                         _p2pm = _p2nn - _p2on;
  95.                         diag_log(format["%1 < %2 ... %3",_p2on,_p2nn,_p2pm]);
  96.              
  97.                     } else {
  98.                         _p2pm = _p2nn - _p2on;
  99.                         diag_log(format["%1 > %2 ... %3",_p2on,_p2nn,_p2pm]);
  100.  
  101.                     };
  102.                     if (_p2pm < 0) then {
  103.                         [true,_p2pm] call fnc_p2flashGold;
  104.                     } else {
  105.                         [false,_p2pm] call fnc_p2flashGold;
  106.                     };
  107.                 };
  108.             };
  109.         };
  110.     };
  111. }
Advertisement
Add Comment
Please, Sign In to add comment