diff --git a/ReallifeGamemode.Client/Gui/nametags.ts b/ReallifeGamemode.Client/Gui/nametags.ts index 90c36098..9cf0618d 100644 --- a/ReallifeGamemode.Client/Gui/nametags.ts +++ b/ReallifeGamemode.Client/Gui/nametags.ts @@ -13,11 +13,16 @@ export default function customNametags() { mp.events.addDataHandler("nameTagColor", (entity, value) => { if (entity.type === "player") { var color = JSON.parse(value); - //entity.setVariable('nametagColor',value) - mp.gui.chat.push(color); + entity.setVariable('nametagColor',color) + //mp.gui.chat.push(color); } }); + mp.events.add('setNameTag', (value) => { + var color = JSON.parse(value); + mp.gui.chat.push(color); + }); + mp.events.add('render', (nametags) => { const graphics = mp.game.graphics; const screenRes = graphics.getScreenResolution(0, 0); @@ -40,8 +45,8 @@ export default function customNametags() { mp.game.graphics.drawText(player.name + " (" + player.remoteId + ")", [x, y], { font: 4, - //color: [player.data.nametagColor[0], player.data.nametagColor[1], player.data.nametagColor[2], 200], //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: [255, 255, 255, 255], + color: [player.data.nametagColor[0], player.data.nametagColor[1], player.data.nametagColor[2], 200], //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: [255, 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 d749ae7d..8e978c02 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -279,13 +279,15 @@ namespace ReallifeGamemode.Server.Events //LSPD case 1: //nameTagColor = new Color(28, 134, 238); - player.SetSharedData("nameTagColor", new int[] { 28, 134, 238}); + player.TriggerEvent("setNameTag", JsonConvert.SerializeObject(new int[] { 28, 134, 238 })) + player.SetSharedData("nameTagColor", JsonConvert.SerializeObject(new int[] { 28, 134, 238})); player.SetSharedData("blipColor", 38); break; //Medic case 2: //nameTagColor = new Color(255, 0, 0); + player.TriggerEvent("setNameTag", JsonConvert.SerializeObject(new int[] { 255, 0, 0 })); player.SetSharedData("nameTagColor", new int[] { 255, 0, 0}); player.SetSharedData("blipColor", 79); break;