Advertisement
Brenner650

playernames.sqf

Aug 18th, 2019
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.72 KB | None | 0 0
  1. span class="re5"> nameDistance = _this select 0;
  2. showDistance = _this select 1;
  3.  
  4. uisleep 180;
  5. while {true} do
  6. {
  7.     _currentPlayerCount = count allPlayers;
  8.     waitUntil {
  9.         _currentPlayerCount > 1;
  10.     };
  11.    
  12.     ShowPlayerNames = addMissionEventHandler ["Draw3D",
  13.     {
  14.         _players = allPlayers;
  15.         {
  16.             if (!(isNull _x) && (isPlayer _x) && (_x != player)) then
  17.             {
  18.                 _distance = cameraOn distance _x;
  19.                 _alpha = (1-(_distance/nameDistance));
  20.                 _crew = crew (vehicle _x);
  21.                 _name = '';
  22.                 _name1 = '';
  23.                 _clr = [1, 1, 1, _alpha];              
  24.                 {
  25.                     if (_x != player) then
  26.                     {
  27.                         _name = format ['%3%1%2', ['', format ['%1, ', _name]] select (_name != ''), name _x, ['', format ['[%1] ', round(player distance _x)]] select (showDistance)];
  28.                     };
  29.                 } forEach _crew;
  30.                 if ((getPlayerUID _x) in ["UID0"]) then
  31.                 {
  32.                     _name = format["ADMIN %1",_name];
  33.                     _clr = [1, 0, 0, _alpha];
  34.                 };
  35.                 if ((getPlayerUID _x) in ["UID1","UID2","UID3"]) then
  36.                 {
  37.                     _name = format["MOD %1",_name];
  38.                     _clr = [0, 1, 0, _alpha];
  39.                 };
  40.                 _veh = vehicle _x;
  41.                 _bbr = boundingBoxReal _veh;
  42.                 _p1 = _bbr select 0;
  43.                 _p2 = _bbr select 1;
  44.                 _maxHeight = (abs ((_p2 select 2) - (_p1 select 2))) * 1.25;
  45.                 _pos = visiblePosition _veh;
  46.                 _pos set[2,(_pos select 2) + _maxHeight];
  47.                
  48.                 drawIcon3D['', _clr, _pos, 0, 0, 0, _name, 1, 0.03];
  49.                 // texture (null), color (_clr), position (_pos), width (0), height (0), angle (0), text (_name), shadow (1), textSize (0.03), font, textAlign, drawSideArrows
  50.             };
  51.         } forEach _players;
  52.     }];
  53.  
  54.     _currentPlayerCount = count allPlayers;
  55.     waitUntil {
  56.         _currentPlayerCount != count allPlayers;
  57.     };
  58.    
  59.     removeMissionEventHandler ["Draw3D", ShowPlayerNames];
  60.    
  61.     uisleep 1;
  62. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement