Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 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),["CAManBase","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 && {!isNil {_x getVariable "rank"}}): {format ["<img image='%1' size='1'></img> %2",switch ((_x getVariable "rank")) do {
  46. case 2: {"\a3\ui_f\data\gui\cfg\Ranks\corporal_gs.paa"};
  47. case 3: {"\a3\ui_f\data\gui\cfg\Ranks\sergeant_gs.paa"};
  48. case 4: {"\a3\ui_f\data\gui\cfg\Ranks\lieutenant_gs.paa"};
  49. case 5: {"\a3\ui_f\data\gui\cfg\Ranks\captain_gs.paa"};
  50. case 6: {"\a3\ui_f\data\gui\cfg\Ranks\major_gs.paa"};
  51. case 7: {"\a3\ui_f\data\gui\cfg\Ranks\colonel_gs.paa"};
  52. case 8: {"\a3\ui_f\data\gui\cfg\Ranks\general_gs.paa"};
  53. default {"\a3\ui_f\data\gui\cfg\Ranks\private_gs.paa"};
  54. },_x getVariable ["realname",name _x]]};
  55. 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]]};
  56. default {
  57. if (!isNil {(group _x) getVariable "gang_name"}) then {
  58. format ["%1<br/><t size='0.8' color='#B6B6B6'>%2</t>",_x getVariable ["realname",name _x],(group _x) getVariable ["gang_name",""]];
  59. } else {
  60. if (alive _x) then {
  61. _x getVariable ["realname",name _x];
  62. } else {
  63. if (!isPlayer _x) then {
  64. _x getVariable ["realname","ERROR"];
  65. };
  66. };
  67. };
  68. };
  69. };
  70.  
  71. _idc ctrlSetStructuredText parseText _text;
  72. _idc ctrlSetPosition [_sPos select 0, _sPos select 1, 0.4, 0.65];
  73. _idc ctrlSetScale scale;
  74. _idc ctrlSetFade 0;
  75. _idc ctrlCommit 0;
  76. _idc ctrlShow true;
  77. } else {
  78. _idc ctrlShow false;
  79. };
  80. } else {
  81. _idc ctrlShow false;
  82. };
  83. } else {
  84. _idc ctrlShow false;
  85. };
  86. _index = _forEachIndex;
  87. } forEach _units;
  88. (_ui displayCtrl (iconID + _index + 1)) ctrlSetStructuredText parseText "";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement