I'm using a script I found a while back for showing player's names above their heads (linked below). I'm posting this here, as I am not having problem with the base script and the original thread doesn't seem to get much attention.
I'm having an issue with trying to customize the code so that my admin's names show up red, while the player's names continue to show up blue. I did something similar with player markers on the map and it worked perfectly. When I implement the same code in the player names script, the names stop showing up at all. No errors regarding this in the RPT.
I'm using a script I found a while back for showing player's names above their heads (linked below). I'm posting this here, as I am not having problem with the base script and the original thread doesn't seem to get much attention.
I'm having an issue with trying to customize the code so that my admin's names show up red, while the player's names continue to show up blue. I did something similar with player markers on the map and it worked perfectly. When I implement the same code in the player names script, the names stop showing up at all. No errors regarding this in the RPT.
I'm stumped.
The code I am using that works:
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 = [0, 0, 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;
};
The code I am trying to use that makes it stop working:
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));
if ((getPlayerUID _x) in ["UID1","UID1","UID1","UID1","UID1"]) then
{
_clr = [0, 1, 0, _alpha];
}
else
{
_clr = [0, 0, 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;
};
Share this post
Link to post
Share on other sites