Advertisement
TheMisticogamer

rr

Oct 11th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_playerTags.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Adds the tags above other players heads when close and have visible range.
  8. */
  9. if (!life_settings_tagson) exitWith {};
  10. private ["_ui","_units","_masks"];
  11. #define iconID 78000
  12. #define scale 0.8
  13.  
  14. if (visibleMap || {!alive player} || {dialog}) exitWith {
  15. 500 cutText["","PLAIN"];
  16. };
  17.  
  18. _ui = uiNamespace getVariable ["Life_HUD_nameTags",displayNull];
  19. if (isNull _ui) then {
  20. 500 cutRsc["Life_HUD_nameTags","PLAIN"];
  21. _ui = uiNamespace getVariable ["Life_HUD_nameTags",displayNull];
  22. };
  23.  
  24. _units = nearestObjects[(visiblePosition player),["Man","Land_Pallet_MilBoxes_F","Land_Sink_F"],50];
  25. _units = _units - [player];
  26.  
  27. _masks = LIFE_SETTINGS(getArray,"clothing_masks");
  28.  
  29. private _index = -1;
  30. {
  31. private "_text";
  32. _idc = _ui displayCtrl (iconID + _forEachIndex);
  33. if (!(lineIntersects [eyePos player, eyePos _x, player, _x]) && alive _x && {!isNil {_x getVariable "realname"}}) then {
  34. _pos = switch (typeOf _x) do {
  35. case "Land_Pallet_MilBoxes_F": {[visiblePosition _x select 0, visiblePosition _x select 1, (getPosATL _x select 2) + 1.5]};
  36. case "Land_Sink_F": {[visiblePosition _x select 0, visiblePosition _x select 1, (getPosATL _x select 2) + 2]};
  37. default {[visiblePosition _x select 0, visiblePosition _x select 1, ((_x modelToWorld (_x selectionPosition "head")) select 2)+.5]};
  38. };
  39. _sPos = worldToScreen _pos;
  40. _distance = _pos distance player;
  41. if (!((headgear _x) in _masks || (goggles _x) in _masks || (uniform _x) in _masks)) then {
  42. if (count _sPos > 1 && {_distance < 15}) then {
  43. _text = switch (true) do {
  44. case (_x in (units group player) && playerSide isEqualTo civilian): {format ["<t color='#00FF00'>%1</t>",(_x getVariable ["realname",name _x])];};
  45. case (side _x isEqualTo west): {format ["%1",(_x getVariable ["realname",name _x])];};
  46. case (side _x isEqualTo independent): {format ["<t color='#FF0000'><img image='a3\ui_f\data\map\MapControl\hospital_ca.paa' size='1.5'></img></t> %1",_x getVariable ["realname",name _x]]};
  47. default {
  48. if (!isNil {(group _x) getVariable "gang_name"}) then {
  49. format ["%1<br/><t size='0.8' color='#B6B6B6'>%2</t>",_x getVariable ["realname",name _x],(group _x) getVariable ["gang_name",""]];
  50. } else {
  51. if (alive _x) then {
  52. _x getVariable ["realname",name _x];
  53. } else {
  54. if (!isPlayer _x) then {
  55. _x getVariable ["realname","ERROR"];
  56. };
  57. };
  58. };
  59. };
  60. };
  61.  
  62. _idc ctrlSetStructuredText parseText _text;
  63. _idc ctrlSetPosition [_sPos select 0, _sPos select 1, 0.4, 0.65];
  64. _idc ctrlSetScale scale;
  65. _idc ctrlSetFade 0;
  66. _idc ctrlCommit 0;
  67. _idc ctrlShow true;
  68. } else {
  69. _idc ctrlShow false;
  70. };
  71. } else {
  72. _idc ctrlShow false;
  73. };
  74. } else {
  75. _idc ctrlShow false;
  76. };
  77. _index = _forEachIndex;
  78. } forEach _units;
  79. (_ui displayCtrl (iconID + _index + 1)) ctrlSetStructuredText parseText "";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement