TTRS Hack Panel (Clean)

Fixed syntax + working

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         TTRS Hack Panel (Clean)
// @namespace    https://example.com/ttrs-helper
// @version      6.6
// @description  Fixed syntax + working
// @author       You
// @license      MIT
// @match        https://play.ttrockstars.com/*
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  let delayMs = 500;
  let tickHandle = null;
  let autoEnabled = false;
  let hidden = false;

  // ===== GUI =====
  const gui = document.createElement('div');
  gui.style.position = 'fixed';
  gui.style.top = '20px';
  gui.style.right = '20px';
  gui.style.background = '#222';
  gui.style.color = '#fff';
  gui.style.padding = '10px';
  gui.style.zIndex = '99999';

  const status = document.createElement('div');
  status.textContent = 'OFF (M)';
  gui.appendChild(status);

  document.body.appendChild(gui);

  // ===== Overlay =====
  const overlay = document.createElement('div');
  overlay.style.position = 'fixed';
  overlay.style.top = '0';
  overlay.style.left = '0';
  overlay.style.width = '100%';
  overlay.style.height = '100%';
  overlay.style.background = 'rgba(0,0,0,0.8)';
  overlay.style.color = '#0f0';
  overlay.style.display = 'none';
  overlay.style.alignItems = 'center';
  overlay.style.justifyContent = 'center';
  overlay.style.fontSize = '40px';
  overlay.style.zIndex = '100000';
  overlay.textContent = 'RUNNING';
  document.body.appendChild(overlay);

  function tick() {
    const x = window.innerWidth / 2;
    const y = window.innerHeight / 2;
    const el = document.elementFromPoint(x, y);
    if (el) el.click();
  }

  function start() {
    autoEnabled = true;
    status.textContent = 'ON';
    overlay.style.display = 'flex';
    tickHandle = setInterval(tick, delayMs);
  }

  function stop() {
    autoEnabled = false;
    status.textContent = 'OFF';
    overlay.style.display = 'none';
    clearInterval(tickHandle);
  }

  // ===== CONTROLS =====
  document.addEventListener('keydown', (e) => {

    if (e.key.toLowerCase() === 'm') {
      autoEnabled ? stop() : start();
    }

    if (e.key === 'Tab') {
      e.preventDefault();
      hidden = true;
      gui.style.display = 'none';
      overlay.style.display = 'none';
    }

    if (e.key === 'Escape') {
      hidden = false;
      gui.style.display = 'block';
      if (autoEnabled) overlay.style.display = 'flex';
    }

  });

})();