const SetNameTag = (player) => {
try {
if (!player || !mp.players.exists(player))
return;
if (player['INVISIBLE'] || player['HideNick']) {
player.nameTag = false;
} else {
let uuid = `~n~#${player['UUID']}`;
if (player['REDNAME']) {
player.nameTag = `~r~${player.name.replace('_', ' ')} (${player.remoteId})` + uuid;
} else {
player.nameTag = global.getName(player) + uuid;
}
player.nameWidth = ((text, font, scale) => (
mp.game.ui.setTextEntryForWidth("STRING"),
mp.game.ui.addTextComponentSubstringPlayerName(text),
mp.game.ui.setTextFont(font),
mp.game.ui.setTextScale(scale, scale),
mp.game.ui.getTextScreenWidth(true)
))(player.nameTag, nameSettings.font, nameSettings.scale);
player.nameHeight = mp.game.ui.getTextScaleHeight(nameSettings.scale, nameSettings.font);
}
}
catch (e)
{
mp.events.callRemote("client_trycatch", "player/gametag", "SetNameTag", e.toString());
}
}