TGViewer
ботик ботик @botikst · 22 subscribers
Post #47 148
Буфер бега/ходьбы
import { world, system } from "@minecraft/server";

function isPlayerMoving(player) {
const playerVelocity = player.getVelocity();
const playerRotation = player.getRotation();
const rotationRadians = playerRotation.y * Math.PI / 180;
const forwardX = -Math.sin(rotationRadians);
const forwardZ = Math.cos(rotationRadians);

const thresholdRun = 0.25;
const thresholdWalk = 0.1;
const thresholdStop = 0.01;

const dotProduct = playerVelocity.x * forwardX + playerVelocity.z * forwardZ;

if (dotProduct > thresholdRun) {
player.runCommandAsync("title @a actionbar Бежит");
} else if (dotProduct > thresholdWalk) {
player.runCommandAsync("title @a actionbar идет");
} else if (dotProduct < thresholdStop) {
player.runCommandAsync("title @a actionbar Стоит на месте");
}
}

system.runInterval(() => {
const players = world.getAllPlayers();

for (const player of players) {
isPlayerMoving(player);
}
});
More from @botikst
  1. Sep 6, 2026пример WebSocket10
  2. Sep 6, 2026Файл скрипт WebSocket10
  3. Sep 6, 2026файл apk termux
  4. Sep 6, 2026Скрипт WebSocket10 const TelegramBot = require('node-telegram-bot-api'); const WebSocket =…
  5. Sep 6, 2026Команды termux: termux-setup-storage pkg update && pkg upgrade -y pkg install nodejs-lts n…
  6. Jul 26, 2026Пример «Импульс»
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →