diff --git a/ReallifeGamemode.Client/Gui/nametags.ts b/ReallifeGamemode.Client/Gui/nametags.ts index af6351aa..ace0c4b1 100644 --- a/ReallifeGamemode.Client/Gui/nametags.ts +++ b/ReallifeGamemode.Client/Gui/nametags.ts @@ -4,11 +4,18 @@ const height = 0.0065; const border = 0.001; const color = [73, 137, 0, 255]; var faction; +var playerColors = []; export default function customNametags() { mp.nametags.enabled = false; + mp.events.addDataHandler("nameTagColor", (entity, value) => { + if (entity.type === "player") { + entity.setVariable('nametagColor', value) + } + }); + mp.events.add('render', (nametags) => { const graphics = mp.game.graphics; const screenRes = graphics.getScreenResolution(0, 0); @@ -26,11 +33,10 @@ export default function customNametags() { var armour = player.getArmour() / 100; y -= scale * (0.005 * (screenRes.y / 1080)); - mp.game.graphics.drawText(player.name + " (" + player.remoteId + ")", [x, y], { font: 4, - color: [255, 255, 255, 255], //Grove //Ballas 171 0 207 //PD 0 95 190 //FIB 0 0 170 LSED 147 0 0 NR 0 166 133 Trucker 255 162 Support 0 255 255 Zivilist 255 255 255 + color: player.data.nametagColor, //Grove //Ballas 171 0 207 //PD 0 95 190 //FIB 0 0 170 LSED 147 0 0 NR 0 166 133 Trucker 255 162 Support 0 255 255 Zivilist 255 255 255 scale: [0.4, 0.4], outline: true, centre: false diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index 474d6d44..fe990230 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -278,19 +278,22 @@ namespace ReallifeGamemode.Server.Events { //LSPD case 1: - nameTagColor = new Color(28, 134, 238); + //nameTagColor = new Color(28, 134, 238); + player.SetSharedData("nameTagColor", new Color[28, 134, 238, 255]); player.SetSharedData("blipColor", 38); break; //Medic case 2: - nameTagColor = new Color(255, 0, 0); + //nameTagColor = new Color(255, 0, 0); + player.SetSharedData("nameTagColor", new Color[255, 0, 0, 255]); player.SetSharedData("blipColor", 79); break; //FBI case 3: - nameTagColor = new Color(173, 0, 118); + //nameTagColor = new Color(173, 0, 118); + player.SetSharedData("nameTagColor", new Color[173, 0, 118, 255]); player.SetSharedData("blipColor", 72); player.SetAccessories(2, 2, 0); break; @@ -326,6 +329,7 @@ namespace ReallifeGamemode.Server.Events player.TriggerEvent("toggleDutyMode", false); Medic.UpdateDutyMedics(-1); player.SetSharedData("blipColor", 0); + player.SetSharedData("nameTagColor", new Color[255, 255, 255, 255]); UpdateCharacterCloth.LoadCharacterDefaults(player); } } diff --git a/ReallifeGamemode.Server/Events/Login.cs b/ReallifeGamemode.Server/Events/Login.cs index 9db87c76..2f6eb2fb 100644 --- a/ReallifeGamemode.Server/Events/Login.cs +++ b/ReallifeGamemode.Server/Events/Login.cs @@ -108,10 +108,12 @@ namespace ReallifeGamemode.Server.Events case 8: player.SetSharedData("blipColor", 83); + player.SetSharedData("nameTagColor", new Color[171, 0, 207, 255]); break; case 7: player.SetSharedData("blipColor", 52); + player.SetSharedData("nameTagColor", new Color[0, 54, 0, 255]); break; case 4: @@ -119,6 +121,7 @@ namespace ReallifeGamemode.Server.Events break; case 9: player.SetSharedData("blipColor", 25); + player.SetSharedData("nameTagColor", new Color[0, 166, 133, 255]); break; }