Nametag fix ?
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
const maxDistance = 25 * 25;
|
||||
import { IGame, IEntity } from "../game";
|
||||
import game from "..";
|
||||
|
||||
|
||||
const maxDistance = 25 * 25;
|
||||
const width = 0.03;
|
||||
const height = 0.0065;
|
||||
const border = 0.001;
|
||||
const color = [73, 137, 0, 255];
|
||||
var faction;
|
||||
var playerColors = [];
|
||||
|
||||
const alpha = 250;
|
||||
|
||||
const colors = [
|
||||
{ id: -2, color: [0, 255, 255, alpha] }, //support
|
||||
{ id: -1, color: [255, 100, 0, alpha] }, //wanted
|
||||
@@ -28,24 +31,21 @@ const colors = [
|
||||
export default function customNametags() {
|
||||
|
||||
mp.nametags.enabled = false;
|
||||
var color = [255, 255, 255, alpha];
|
||||
|
||||
|
||||
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) {
|
||||
entity.setVariable("nametagColor", [255, 255, 255, alpha]);
|
||||
player.nametagColor = [255, 255, 255, alpha];
|
||||
return;
|
||||
}
|
||||
entity.setVariable("nametagColor", temp.color);
|
||||
player.nametagColor = temp.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;
|
||||
@@ -64,7 +64,7 @@ export default function customNametags() {
|
||||
var armour = player.getArmour() / 100;
|
||||
|
||||
y -= scale * (0.005 * (screenRes.y / 1080));
|
||||
let color = player.data.nametagColor;
|
||||
let color = game.players.at(player.remoteId).nametagColor;
|
||||
mp.game.graphics.drawText(player.name + " (" + player.remoteId + ")", [x, y],
|
||||
{
|
||||
font: 4,
|
||||
|
||||
@@ -53,6 +53,7 @@ interface IPlayer extends IEntity {
|
||||
inVehicle: boolean;
|
||||
name: string;
|
||||
vehicle: IVehicle;
|
||||
nametagColor: number[];
|
||||
}
|
||||
|
||||
interface IObject extends IEntity {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { IGame, EntityType, IEntity } from "../game";
|
||||
import relativeVector from "./relativevector";
|
||||
import { IGame, IEntity } from "../game";
|
||||
|
||||
var attachId = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user