Fixed syntax + working
// ==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';
}
});
})();