Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.89 KB | None | 0 0
  1. /*
  2. @file Version: 0.1
  3. @file Name: statusBar.sqf
  4. @file EpochMod StatusBar Port for Wasteland / EXILE by CRE4MPIE
  5. @file Created: 21/4/2015
  6. @notes: Added custom Icons and ported Wasteland info. Still
  7. needs to be cleaned up a bit.
  8. */
  9.  
  10. waitUntil {!(isNull (findDisplay 46))};
  11. disableSerialization;
  12.  
  13. _rscLayer = "osefStatusBarAdmin" call BIS_fnc_rscLayer;
  14. _rscLayer cutRsc["osefStatusBarAdmin","PLAIN"];
  15. // systemChat format["StatusBar Initialized", _rscLayer];
  16. [] spawn
  17. {
  18.  
  19. uiSleep 5;
  20. //set the color values.
  21. //Additional color codes can be found here: http://html-color-codes.com/
  22. _colourDefault = parseText "#adadad"; //set your default colour here
  23. _colour108 = parseText "#FF7000";
  24. _colour107 = parseText "#FF9000";
  25. _colour106 = parseText "#FFBB00";
  26. _colour105 = parseText "#FFCC00";
  27. _colour104 = parseText "#81CCDD";
  28. _colour103 = parseText "#33AACC";
  29. _colour102 = parseText "#3388CC";
  30. _colour101 = parseText "#3366CC";
  31. _colour100 = parseText "#336600";
  32. _colour90 = parseText "#339900";
  33. _colour80 = parseText "#33CC00";
  34. _colour70 = parseText "#33FF00";
  35. _colour60 = parseText "#66FF00";
  36. _colour50 = parseText "#CCFF00";
  37. _colour40 = parseText "#CCCC00";
  38. _colour30 = parseText "#CC9900";
  39. _colour20 = parseText "#CC6600";
  40. _colour10 = parseText "#CC3300";
  41. _colour0 = parseText "#CC0000";
  42. _colourDead = parseText "#000000";
  43. _uid = getPlayerUID player;
  44.  
  45.  
  46. while {true} do
  47. {
  48.  
  49. uiSleep 1;
  50.  
  51. //moved the creation of the status bar inside the loop and create it if it is null,
  52. //this is to handle instance where the status bar is disappearing
  53. if(isNull ((uiNamespace getVariable "osefStatusBarAdmin")displayCtrl 55554)) then
  54. {
  55. diag_log "statusbar is null create";
  56. disableSerialization;
  57. _rscLayer = "osefStatusBarAdmin" call BIS_fnc_rscLayer;
  58. _rscLayer cutRsc["osefStatusBarAdmin","PLAIN"];
  59. };
  60.  
  61. //initialize variables and set values
  62. _unit = _this select 0;
  63. _damage = round ((1 - (damage player)) * 100);
  64. //_damage = (round(_damage * 100));
  65. _hunger = round (ExileClientPlayerAttributes select 2);
  66. _thirst = round (ExileClientPlayerAttributes select 3);
  67. _wallet = ExileMoney;
  68. _locker = ExileLocker;
  69. _stamina = ExileClientPlayerScore;
  70. _energy = 100;
  71. _energyPercent = 100;
  72. _serverFPS = round diag_fps;
  73. _pos = getPosATL player;
  74. _dir = round (getDir (vehicle player));
  75. _grid = mapGridPosition player; _xx = (format[_grid]) select [0,3];
  76. _yy = (format[_grid]) select [3,3];
  77. _time = (round(360-(serverTime)/60)); //edit the '240' value (60*4=240) to change the countdown timer if your server restarts are shorter or longer than 4 hour intervals
  78. _hours = (floor(_time/60));
  79. _minutes = (_time - (_hours * 60));
  80.  
  81. switch(_minutes) do
  82. {
  83. case 9: {_minutes = "09"};
  84. case 8: {_minutes = "08"};
  85. case 7: {_minutes = "07"};
  86. case 6: {_minutes = "06"};
  87. case 5: {_minutes = "05"};
  88. case 4: {_minutes = "04"};
  89. case 3: {_minutes = "03"};
  90. case 2: {_minutes = "02"};
  91. case 1: {_minutes = "01"};
  92. case 0: {_minutes = "00"};
  93. };
  94.  
  95.  
  96.  
  97. //Colour coding
  98. //Damage
  99.  
  100. _colourDamage = _colourDefault;
  101. if(_damage >= 100) then{_colourDamage = _colour100;};
  102. if((_damage >= 90) && (_damage < 100)) then {_colourDamage = _colour100;};
  103. if((_damage >= 80) && (_damage < 90)) then {_colourDamage = _colour80;};
  104. if((_damage >= 70) && (_damage < 80)) then {_colourDamage = _colour70;};
  105. if((_damage >= 60) && (_damage < 70)) then {_colourDamage = _colour60;};
  106. if((_damage >= 50) && (_damage < 60)) then {_colourDamage = _colour50;};
  107. if((_damage >= 40) && (_damage < 50)) then {_colourDamage = _colour40;};
  108. if((_damage >= 30) && (_damage < 40)) then {_colourDamage = _colour30;};
  109. if((_damage >= 20) && (_damage < 30)) then {_colourDamage = _colour20;};
  110. if((_damage >= 10) && (_damage < 20)) then {_colourDamage = _colour10;};
  111. if((_damage >= 1) && (_damage < 10)) then {_colourDamage = _colour0;};
  112. if(_damage < 1) then{_colourDamage = _colourDead;};
  113.  
  114.  
  115.  
  116. //Hunger
  117. _colourHunger = _colourDefault;
  118. if(_hunger >= 100) then{_colourHunger = _colour100;};
  119. if((_hunger >= 90) && (_hunger < 100)) then {_colourHunger = _colour90;};
  120. if((_hunger >= 80) && (_hunger < 90)) then {_colourHunger = _colour80;};
  121. if((_hunger >= 70) && (_hunger < 80)) then {_colourHunger = _colour70;};
  122. if((_hunger >= 60) && (_hunger < 70)) then {_colourHunger = _colour60;};
  123. if((_hunger >= 50) && (_hunger < 60)) then {_colourHunger = _colour50;};
  124. if((_hunger >= 40) && (_hunger < 50)) then {_colourHunger = _colour40;};
  125. if((_hunger >= 30) && (_hunger < 40)) then {_colourHunger = _colour30;};
  126. if((_hunger >= 20) && (_hunger < 30)) then {_colourHunger = _colour20;};
  127. if((_hunger >= 10) && (_hunger < 20)) then {_colourHunger = _colour10;};
  128. if((_hunger >= 1) && (_hunger < 10)) then {_colourHunger = _colour0;};
  129. if(_hunger < 1) then{_colourHunger = _colourDead;};
  130.  
  131.  
  132. //Thirst
  133. _colourThirst = _colourDefault;
  134. switch true do{
  135.  
  136. case(_thirst >= 100) : {_colourThirst = _colour101;};
  137. case((_thirst >= 90) && (_thirst < 100)) : {_colourThirst = _colour102;};
  138. case((_thirst >= 80) && (_thirst < 90)) : {_colourThirst = _colour103;};
  139. case((_thirst >= 70) && (_thirst < 80)) : {_colourThirst = _colour104;};
  140. case((_thirst >= 60) && (_thirst < 70)) : {_colourThirst = _colour105;};
  141. case((_thirst >= 50) && (_thirst < 60)) : {_colourThirst = _colour106;};
  142. case((_thirst >= 40) && (_thirst < 50)) : {_colourThirst = _colour107;};
  143. case((_thirst >= 30) && (_thirst < 40)) : {_colourThirst = _colour108;};
  144. case((_thirst >= 20) && (_thirst < 30)) : {_colourThirst = _colour20;};
  145. case((_thirst >= 10) && (_thirst < 20)) : {_colourThirst = _colour10;};
  146. case((_thirst >= 1) && (_thirst < 10)) : {_colourThirst = _colour0;};
  147. case(_thirst < 1) : {_colourThirst = _colourDead;};
  148. };
  149.  
  150.  
  151.  
  152. //Energy
  153. _colourEnergy = _colourDefault;
  154. if(_energyPercent >= 100) then{_colourEnergy = _colour100;};
  155. if((_energyPercent >= 90) && (_energyPercent < 100)) then {_colourEnergy = _colour90;};
  156. if((_energyPercent >= 80) && (_energyPercent < 90)) then {_colourEnergy = _colour80;};
  157. if((_energyPercent >= 70) && (_energyPercent < 80)) then {_colourEnergy = _colour70;};
  158. if((_energyPercent >= 60) && (_energyPercent < 70)) then {_colourEnergy = _colour60;};
  159. if((_energyPercent >= 50) && (_energyPercent < 60)) then {_colourEnergy = _colour50;};
  160. if((_energyPercent >= 40) && (_energyPercent < 50)) then {_colourEnergy = _colour40;};
  161. if((_energyPercent >= 30) && (_energyPercent < 40)) then {_colourEnergy = _colour30;};
  162. if((_energyPercent >= 20) && (_energyPercent < 30)) then {_colourEnergy = _colour20;};
  163. if((_energyPercent >= 10) && (_energyPercent < 20)) then {_colourEnergy = _colour10;};
  164. if((_energyPercent >= 1) && (_energyPercent < 10)) then {_colourEnergy = _colour0;};
  165. if(_energyPercent < 1) then{_colourEnergy = _colour0;};
  166.  
  167.  
  168. //Stamina
  169. _colourStamina = _colourDefault;
  170.  
  171. //display the information
  172. ((uiNamespace getVariable "osefStatusBarAdmin")displayCtrl 55554)ctrlSetStructuredText parseText
  173. format["
  174. <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\statusbar\icons\players.paa' color='%10'/> %2</t>
  175. <t shadow='1' shadowColor='#000000' color='%11'><img size='1.0' shadowColor='#000000' image='addons\statusbar\icons\health.paa' color='%11'/> %3%1</t>
  176. <t shadow='1' shadowColor='#000000' color='%10'><img size='1.0' shadowColor='#000000' image='addons\statusbar\icons\poptab_ca.paa' color='%10'/> %4</t>
  177. <t shadow='1' shadowColor='#000000' color='%12'><img size='1.6' shadowColor='#000000' image='addons\statusbar\icons\hunger.paa' color='%12'/> %5%1</t>
  178. <t shadow='1' shadowColor='#000000' color='%13'><img size='1.6' shadowColor='#000000' image='addons\statusbar\icons\thirst.paa' color='%13'/> %6%1</t>
  179. <t shadow='1' shadowColor='#000000' color='%15'><img size='1.0' shadowColor='#000000' image='addons\statusbar\icons\exile.paa' color='%10'/> %9</t>
  180. <t shadow='1' shadowColor='#000000' color='%10'>FPS: %7</t>
  181. <t shadow='1' shadowColor='#000000' color='%15'><img size='1.0' shadowColor='#000000' image='addons\statusbar\icons\compass.paa' color='%10'/> %17</t>
  182. <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\statusbar\icons\restart.paa' color='%10'/>%18:%19</t>",
  183.  
  184. "%",
  185. count playableUnits,
  186. _damage,
  187. _wallet,
  188. _locker,
  189. _hunger,
  190. _thirst,
  191. _serverFPS,
  192. _energyPercent,
  193. _stamina,
  194. _colourDefault,
  195. _colourDamage,
  196. _colourHunger,
  197. _colourThirst,
  198. _colourEnergy,
  199. _colourStamina,
  200. format["%1/%2",_xx,_yy],
  201. _dir,
  202. _hours,
  203. _minutes
  204. ];
  205.  
  206. };
  207. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement