RevoLand

Floating player names/icons (group only/all)

2 posts in this topic

Here is an updated script for playerNames which adds distance to names if preferred.

 

Group only:

add to top of initPlayerLocal.sqf:

[15000 // maximum distance to show name
,true // show distance to player? (false = dont show)
] execVM "addons\scripts\playerNames.sqf";

playerNames.sqf:

nameDistance = _this select 0;
showDistance = _this select 1;

while {true} do
{
	waitUntil {
		count units (group player) > 1;
	};
	
	ShowGroupMemberNames = addMissionEventHandler ["Draw3D",
	{
		_members = units (group player);
		{
			if (!(isNull _x) && (isPlayer _x) && (_x != player)) then
			{
				_distance = cameraOn distance _x;
				_alpha = (1-(_distance/nameDistance));
				_clr = [1, 1, 1, _alpha];
				_crew = crew (vehicle _x);
				_name = '';
				{
					if (_x != player) then
					{
						_name = format ['%3%1%2', ['', format ['%1, ', _name]] select (_name != ''), name _x, ['', format ['[%1] ', round(player distance _x)]] select (showDistance)];
					};
				} forEach _crew;
				_veh = vehicle _x;
				_bbr = boundingBoxReal _veh;
				_p1 = _bbr select 0;
				_p2 = _bbr select 1;
				_maxHeight = (abs ((_p2 select 2) - (_p1 select 2))) * 1.25; 
				_pos = visiblePosition _veh;
				_pos set[2,(_pos select 2) + _maxHeight];
				
				drawIcon3D['', _clr, _pos, 0, 0, 0, _name, 1, 0.03];
				// texture (null), color (_clr), position (_pos), width (0), height (0), angle (0), text (_name), shadow (1), textSize (0.03), font, textAlign, drawSideArrows
			};
		} forEach _members;
	}];

	_memberCount = count units (group player);
	waitUntil {
		count (units (group player)) != _memberCount;
	};
	
	removeMissionEventHandler ["Draw3D",ShowGroupMemberNames];
	
	sleep 1;
};

Show to all players:

add to top of initPlayerLocal.sqf:

[15000 // maximum distance to show name
,true // show distance to player? (false = dont show)
] execVM "addons\scripts\playerNames.sqf";

playerNames.sqf:

nameDistance = _this select 0;
showDistance = _this select 1;

while {true} do
{
	_currentPlayerCount = count allPlayers;
	waitUntil {
		_currentPlayerCount > 1;
	};
	
	ShowPlayerNames = addMissionEventHandler ["Draw3D",
	{
		_players = allPlayers;
		{
			if (!(isNull _x) && (isPlayer _x) && (_x != player)) then
			{
				_distance = cameraOn distance _x;
				_alpha = (1-(_distance/nameDistance));
				_clr = [1, 1, 1, _alpha];
				_crew = crew (vehicle _x);
				_name = '';
				{
					if (_x != player) then
					{
						_name = format ['%3%1%2', ['', format ['%1, ', _name]] select (_name != ''), name _x, ['', format ['[%1] ', round(player distance _x)]] select (showDistance)];
					};
				} forEach _crew;
				_veh = vehicle _x;
				_bbr = boundingBoxReal _veh;
				_p1 = _bbr select 0;
				_p2 = _bbr select 1;
				_maxHeight = (abs ((_p2 select 2) - (_p1 select 2))) * 1.25; 
				_pos = visiblePosition _veh;
				_pos set[2,(_pos select 2) + _maxHeight];
				
				drawIcon3D['', _clr, _pos, 0, 0, 0, _name, 1, 0.03];
				// texture (null), color (_clr), position (_pos), width (0), height (0), angle (0), text (_name), shadow (1), textSize (0.03), font, textAlign, drawSideArrows
			};
		} forEach _players;
	}];

	_currentPlayerCount = count allPlayers;
	waitUntil {
		_currentPlayerCount != count allPlayers;
	};
	
	removeMissionEventHandler ["Draw3D", ShowPlayerNames];
	
	sleep 1;
};


 

Script for all players is not tested yet, if anyone test and report me the status i will be very happy.

Every improvements are welcome. Free to edit & distribute as you want. :)

Edited by RevoLand

Share this post


Link to post
Share on other sites

Here is an updated script for playerNames which adds distance to names if preferred.

 

Group only:

Hidden Content

Show to all players:

Hidden Content

 

Script for all players is not tested yet, if anyone test and report me the status i will be very happy.

Every improvements are welcome. Free to edit & distribute as you want. :)

This is great man! I noticed one thing so far.. When you are up on a roof or high up the name and distance markers are below the player on the ground. Otherwise this is awesome!

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.