fix NameTags

This commit is contained in:
kookroach
2021-04-04 18:52:53 +02:00
parent 32b4e8b13d
commit d9a292b829
3 changed files with 13 additions and 17 deletions

View File

@@ -31,20 +31,7 @@ const colors = [
export default function customNametags() {
mp.nametags.enabled = false;
mp.events.addDataHandler("nameTagColor", (entity: EntityMp, value) => {
if (entity.type === "player") {
var player = game.players.at(entity.remoteId);
let temp = colors.find(c => c.id === value);
if (!temp) {
player.nametagColor = [255, 255, 255, alpha];
return;
}
player.nametagColor = temp.color;
}
});
mp.events.add('render', (nametags) => {
@@ -64,7 +51,10 @@ export default function customNametags() {
var armour = player.getArmour() / 100;
y -= scale * (0.005 * (screenRes.y / 1080));
let color = game.players.at(player.remoteId).nametagColor;
let colorId = game.players.at(player.remoteId).nametagColor;
let color = colors.find(c => c.id === colorId).color;
mp.game.graphics.drawText(player.name + " (" + player.remoteId + ")", [x, y],
{
font: 4,