LeventHAN

fn_playerTags.sqf

Sep 11th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "..\..\script_macros.hpp"
  2.  
  3. if (!life_settings_tagson) exitWith {};
  4. private ["_ui","_units","_masks"];
  5. #define iconID 78000
  6. #define scale 0.8
  7.  
  8. if (visibleMap || {!alive player} || {dialog}) exitWith {
  9.     500 cutText["","PLAIN"];
  10. };
  11.  
  12. _ui = uiNamespace getVariable ["Life_HUD_nameTags",displayNull];
  13. if (isNull _ui) then {
  14.     500 cutRsc["Life_HUD_nameTags","PLAIN"];
  15.     _ui = uiNamespace getVariable ["Life_HUD_nameTags",displayNull];
  16. };
  17.  
  18. _units = nearestObjects[(visiblePosition player),["Man","Land_Pallet_MilBoxes_F","Land_Sink_F"],50];
  19. _units = _units - [player];
  20.  
  21. _masks = LIFE_SETTINGS(getArray,"clothing_masks");
  22.  
  23. private _index = -1; {
  24.     private "_text";
  25.     _idc = _ui displayCtrl (iconID + _forEachIndex);
  26.     if (!(lineIntersects [eyePos player, eyePos _x, player, _x]) && alive _x && {!isNil {_x getVariable "realname"}}) then {
  27.         _pos = switch (typeOf _x) do {
  28.             case "Land_Pallet_MilBoxes_F": {[visiblePosition _x select 0, visiblePosition _x select 1, (getPosATL _x select 2) + 1.5]};
  29.             case "Land_Sink_F": {[visiblePosition _x select 0, visiblePosition _x select 1, (getPosATL _x select 2) + 2]};
  30.             default {[visiblePosition _x select 0, visiblePosition _x select 1, ((_x modelToWorld (_x selectionPosition "head")) select 2)+.5]};
  31.         };
  32.         _sPos = worldToScreen _pos;
  33.         _distance = _pos distance player;
  34.         if (count _sPos > 1 && {_distance < 15}) then {
  35.             _text = switch (true) do {
  36.                 case (((headgear _x) in _masks || (goggles _x) in _masks || (uniform _x) in _masks) && side _x isEqualTo civilian): {format ["<t><img image='icons\ico_mask.paa' size='1'></img></t><t color='#000000'> Maskeli</t>"]};
  37.                 case (_x in (units group player) && playerSide isEqualTo civilian): {format ["<t color='#00FF00'>%1</t>",(_x getVariable ["realname",name _x])];};
  38.                 case (side _x isEqualTo west && {!isNil {_x getVariable "rank"}}): {format ["<img image='%1' size='1'></img><t color='#00CCFF'>%2</t>",switch ((_x getVariable "rank")) do {
  39.                     case 2: {"icons\ico_copRank2.paa"};
  40.                     case 3: {"icons\ico_copRank3.paa"};
  41.                     case 4: {"icons\ico_copRank4.paa"};
  42.                     case 5: {"icons\ico_copRank5.paa"};
  43.                     case 6: {"icons\ico_copRank6.paa"};
  44.                     case 7: {"icons\ico_copRank7.paa"};
  45.                     case 8: {"icons\ico_copRank8.paa"};
  46.                     default {"icons\ico_copRank1.paa"};
  47.                     },_x getVariable ["realname",name _x]]};
  48.                 case (side _x isEqualTo independent): {format ["<t><img image='icons\ico_medicRank.paa' size='1'></img></t><t color='#FF0000'>%1</t>",_x getVariable ["realname",name _x]]};
  49.                 default {
  50.                     if (!isNil {(group _x) getVariable "gang_name"}) then {
  51.                         format ["<t color='#FFFFFF'>%1</t><br/><t size='0.75' color='#CCCCCC'>%2</t>",_x getVariable ["realname",name _x],(group _x) getVariable ["gang_name",""]];
  52.                     } else {
  53.                         if (alive _x) then {
  54.                            format ["<t color='#FFFFFF'>%1</t>",(_x getVariable ["realname",name _x])];
  55.                         } else {
  56.                             if (!isPlayer _x) then {
  57.                                 _x getVariable ["realname","ERROR"];
  58.                             };
  59.                         };
  60.                     };
  61.                 };
  62.             };
  63.  
  64.             if(_x getVariable ["speaking",false] && side _x isEqualTo civilian) then {_text = "<img image='\A3\ui_f\data\igui\rscingameui\rscdisplayvoicechat\microphone_ca.paa' size='1.25'></img>" + _text};
  65.             if(_x getVariable ["speaking",false] && side _x isEqualTo west) then {_text = "<t color='#00CCFF'><img image='\A3\ui_f\data\igui\rscingameui\rscdisplayvoicechat\microphone_ca.paa' size='1.25'></img></t>" + _text};
  66.             if(_x getVariable ["speaking",false] && side _x isEqualTo independent) then {_text = "<t color='#FF0000'><img image='\A3\ui_f\data\igui\rscingameui\rscdisplayvoicechat\microphone_ca.paa' size='1.25'></img></t>" + _text};
  67.             _idc ctrlSetStructuredText parseText _text;
  68.             _idc ctrlSetPosition [_sPos select 0, _sPos select 1, 0.4, 0.65];
  69.             _idc ctrlSetScale scale;
  70.             _idc ctrlSetFade 0;
  71.             _idc ctrlCommit 0;
  72.             _idc ctrlShow true;
  73.         } else {
  74.             _idc ctrlShow false;
  75.         };
  76.     } else {
  77.         _idc ctrlShow false;
  78.     };
  79.     _index = _forEachIndex;
  80. } forEach _units;
  81. (_ui displayCtrl (iconID + _index + 1)) ctrlSetStructuredText parseText "";
Advertisement