const localPlayer = mp.players.local;
const drawDistance = 50; // Все игроки в радиусе
const drawPosition = 1.2; // Высота текста над головой
mp.events.add("render", () => {
mp.players.forEachInRange(
localPlayer.position,
drawDistance,
(target) => {
if (target === localPlayer || target.vehicle) return;
const health = target.getHealth();
const armour = target.getArmour();
const { x, y, z } = target.position;
const textPositionZ = z + drawPosition;
const distance = mp.game.system.vdist(localPlayer.position.x, localPlayer.position.y, localPlayer.position.z, x, y, z);
if (distance > drawDistance) return;
const screenCoords = mp.game.graphics.world3dToScreen2d(x, y, textPositionZ);
if (screenCoords) {
const [screenX, screenY] = screenCoords;
const displayText = `HP: ${health} | Armour: ${armour}`;
mp.game.graphics.drawText(displayText, [screenX, screenY], {
centre: true,
font: 4,
color: [255, 255, 255, 185],
scale: [0.4, 0.4],
outline: true,
});
}
}
);
});