Guest User

PlayerNames.sqf

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