Snake.io Cheat Engiene

find and edit any values in game memory

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

// ==UserScript==
// @name         Snake.io Cheat Engiene
// @namespace    http://tampermonkey.net/
// @version      2026-04-08
// @description  find and edit any values in game memory
// @author       You
// @match        https://snake.io/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=snake.io
// @grant        none
// ==/UserScript==

(function() {
    let foundAddresses = [];
    let cheatTable = [];
    let currentHeapView = 'All';
    let isInputActive = false;
    let unityInst = null;

    function getUnityInstance() {
        if (window.unityInstance && window.unityInstance.Module) return window.unityInstance.Module;
        if (window.Module) return window.Module;
        return null;
    }

    const heapTypes = {
        All: { view: null, type: 'all', getter: (addr, type) => { return null; } },
        HEAP8: { view: 'HEAP8', type: 'Int8', getter: (addr, module) => module.HEAP8[addr] },
        HEAPU8: { view: 'HEAPU8', type: 'Uint8', getter: (addr, module) => module.HEAPU8[addr] },
        HEAP16: { view: 'HEAP16', type: 'Int16', getter: (addr, module) => module.HEAP16[addr] },
        HEAPU16: { view: 'HEAPU16', type: 'Uint16', getter: (addr, module) => module.HEAPU16[addr] },
        HEAP32: { view: 'HEAP32', type: 'Int32', getter: (addr, module) => module.HEAP32[addr] },
        HEAPU32: { view: 'HEAPU32', type: 'Uint32', getter: (addr, module) => module.HEAPU32[addr] },
        HEAPF32: { view: 'HEAPF32', type: 'Float32', getter: (addr, module) => module.HEAPF32[addr] },
        HEAPF64: { view: 'HEAPF64', type: 'Float64', getter: (addr, module) => module.HEAPF64[addr] }
    };

    const style = document.createElement('style');
    style.innerHTML = `
        #ce-menu { position: fixed; top: 50px; right: 50px; width: 500px; background: #f0f0f0; border: 2px solid #666; z-index: 10000; font-family: 'Segoe UI', Tahoma, sans-serif; font-size: 12px; color: black; display: flex; flex-direction: column; box-shadow: -5px 0 15px rgba(0,0,0,0.3); resize: both; overflow: auto; min-width: 300px; min-height: 400px; }
        .ce-header { background: linear-gradient(to bottom, #eee, #ccc); padding: 5px; border-bottom: 1px solid #999; font-weight: bold; display: flex; justify-content: space-between; cursor: move; }
        .ce-header-buttons { display: flex; gap: 5px; }
        .ce-collapse-btn { cursor: pointer; padding: 0 5px; }
        .ce-collapse-btn:hover { background: rgba(0,0,0,0.1); }
        .ce-main-controls { padding: 10px; display: flex; gap: 10px; border-bottom: 1px solid #ccc; flex-wrap: wrap; }
        .ce-scan-area { flex: 2; }
        .ce-heap-select { flex: 1; }
        .ce-list-container { flex: 1; overflow: auto; background: white; border: 1px solid #999; margin: 5px; min-height: 150px; max-height: 300px; }
        .ce-table { width: 100%; border-collapse: collapse; cursor: default; table-layout: fixed; }
        .ce-table th { background: #e1e1e1; position: sticky; top: 0; border: 1px solid #ccc; padding: 2px; text-align: left; }
        .ce-table td { border: 1px solid #eee; padding: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
        .ce-table tr:hover { background: #e8f2ff; }
        .ce-footer-table { max-height: 200px; border-top: 2px solid #666; }
        button { cursor: pointer; padding: 3px 8px; }
        input[type="text"], select { border: 1px solid #999; padding: 2px; width: 100%; }
        .ce-found-count { font-size: 10px; color: #444; }
    `;
    document.head.appendChild(style);

    const container = document.createElement('div');
    container.id = 'ce-menu';
    container.innerHTML = `
        <div class="ce-header">
            <span>Cheat Engine JS</span>
            <div class="ce-header-buttons">
                <span class="ce-collapse-btn">_</span>
            </div>
        </div>
        <div class="ce-content">
            <div class="ce-main-controls">
                <div class="ce-scan-area">
                    <input type="text" id="ce-scan-val" style="width:100%" placeholder="Value...">
                    <div style="margin-top:5px; display:flex; gap:5px;">
                        <button id="ce-new-scan">New Scan</button>
                        <button id="ce-next-scan">Next Scan</button>
                    </div>
                </div>
                <div class="ce-heap-select">
                    <select id="ce-heap-view">
                        <option value="All" selected>All Variables</option>
                        <option value="HEAP8">HEAP8 (Int8)</option>
                        <option value="HEAPU8">HEAPU8 (Uint8)</option>
                        <option value="HEAP16">HEAP16 (Int16)</option>
                        <option value="HEAPU16">HEAPU16 (Uint16)</option>
                        <option value="HEAP32">HEAP32 (Int32)</option>
                        <option value="HEAPU32">HEAPU32 (Uint32)</option>
                        <option value="HEAPF32">HEAPF32 (Float32)</option>
                        <option value="HEAPF64">HEAPF64 (Float64)</option>
                    </select>
                </div>
            </div>
            <div style="padding:0 10px;"><span class="ce-found-count">Found: <span id="ce-count">0</span></span></div>
            <div class="ce-list-container">
                <table class="ce-table"><thead id="ce-results-head"><tr><th>Address</th><th>Value</th></tr></thead><tbody id="ce-results-body"></tbody></table>
            </div>
            <div class="ce-list-container ce-footer-table">
                <table class="ce-table"><thead><tr><th>Frozen</th><th>Description</th><th>Address</th><th>Value</th></tr></thead><tbody id="ce-table-body"></tbody></table>
            </div>
        </div>
    `;
    document.body.appendChild(container);

    function getModule() {
        let module = getUnityInstance();
        if (!module) {
            console.warn('Unity Module not found, trying window.Module');
            module = window.Module;
        }
        return module;
    }

    function scanHeap(target) {
        let results = [];
        let targetVal = isNaN(target) ? target : Number(target);
        let heapView = currentHeapView;
        let module = getModule();

        if (!module) {
            console.error('Unity Module not available');
            return results;
        }

        if (heapView === 'All') {
            let maxLen = module.HEAP32 ? module.HEAP32.length : 0;
            for (let i = 0; i < maxLen; i++) {
                try {
                    if (module.HEAP8 && module.HEAP8[i] == targetVal) results.push({ addr: i, heap: 'HEAP8', val: module.HEAP8[i] });
                    if (module.HEAPU8 && module.HEAPU8[i] == targetVal) results.push({ addr: i, heap: 'HEAPU8', val: module.HEAPU8[i] });
                    if (i % 2 === 0) {
                        if (module.HEAP16 && module.HEAP16[i/2] == targetVal) results.push({ addr: i, heap: 'HEAP16', val: module.HEAP16[i/2] });
                        if (module.HEAPU16 && module.HEAPU16[i/2] == targetVal) results.push({ addr: i, heap: 'HEAPU16', val: module.HEAPU16[i/2] });
                    }
                    if (i % 4 === 0) {
                        if (module.HEAP32 && module.HEAP32[i/4] == targetVal) results.push({ addr: i, heap: 'HEAP32', val: module.HEAP32[i/4] });
                        if (module.HEAPU32 && module.HEAPU32[i/4] == targetVal) results.push({ addr: i, heap: 'HEAPU32', val: module.HEAPU32[i/4] });
                        if (module.HEAPF32 && module.HEAPF32[i/4] == targetVal) results.push({ addr: i, heap: 'HEAPF32', val: module.HEAPF32[i/4] });
                    }
                    if (i % 8 === 0 && module.HEAPF64 && module.HEAPF64[i/8] == targetVal) results.push({ addr: i, heap: 'HEAPF64', val: module.HEAPF64[i/8] });
                } catch(e) {}
            }
        } else {
            let view = heapTypes[heapView];
            if (!view || !module[view.view]) return results;
            let heap = module[view.view];
            let byteMultiplier = 1;
            if (heapView === 'HEAP16' || heapView === 'HEAPU16') byteMultiplier = 2;
            else if (heapView === 'HEAP32' || heapView === 'HEAPU32' || heapView === 'HEAPF32') byteMultiplier = 4;
            else if (heapView === 'HEAPF64') byteMultiplier = 8;

            for (let i = 0; i < heap.length; i++) {
                try {
                    if (heap[i] == targetVal) results.push({ addr: i * byteMultiplier, heap: heapView, val: heap[i] });
                } catch(e) {}
            }
        }
        return results;
    }

    function filterHeapScan(target, previousResults) {
        let results = [];
        let targetVal = isNaN(target) ? target : Number(target);
        let module = getModule();

        if (!module) return results;

        previousResults.forEach(prev => {
            try {
                let currentVal = heapTypes[prev.heap].getter(prev.addr, module);
                if (currentVal == targetVal) results.push(prev);
            } catch(e) {}
        });
        return results;
    }

    function updateResults() {
        const body = document.getElementById('ce-results-body');
        body.innerHTML = '';
        let module = getModule();
        if (!module) return;

        foundAddresses.slice(0, 100).forEach(addr => {
            const tr = document.createElement('tr');
            let currentVal = heapTypes[addr.heap].getter(addr.addr, module);
            tr.innerHTML = `<td>${addr.heap}:${addr.addr}</td><td>${currentVal}</td>`;
            tr.onclick = () => addToTable(addr);
            body.appendChild(tr);
        });
        document.getElementById('ce-count').innerText = foundAddresses.length;
    }

    function addToTable(addrInfo) {
        if (!cheatTable.find(i => i.heap === addrInfo.heap && i.addr === addrInfo.addr)) {
            let module = getModule();
            cheatTable.push({ heap: addrInfo.heap, addr: addrInfo.addr, frozen: false, value: heapTypes[addrInfo.heap].getter(addrInfo.addr, module) });
            renderTable();
        }
    }

    function renderTable() {
        const body = document.getElementById('ce-table-body');
        body.innerHTML = '';
        let module = getModule();
        if (!module) return;

        cheatTable.forEach((item, index) => {
            const tr = document.createElement('tr');
            let currentVal = heapTypes[item.heap].getter(item.addr, module);
            tr.innerHTML = `
                <td style="text-align:center"><input type="checkbox" ${item.frozen ? 'checked' : ''} onchange="window._ce_freeze(${index}, this.checked)"></td>
                <td>No description</td>
                <td style="word-break:break-all;white-space:normal">${item.heap}:${item.addr}</td>
                <td style="color:blue; cursor:pointer" onclick="window._ce_edit(${index})">${currentVal}</td>
            `;
            body.appendChild(tr);
        });
    }

    window._ce_freeze = (idx, val) => {
        let module = getModule();
        cheatTable[idx].frozen = val;
        cheatTable[idx].value = heapTypes[cheatTable[idx].heap].getter(cheatTable[idx].addr, module);
    };

    window._ce_edit = (idx) => {
        let module = getModule();
        const newVal = prompt("Enter new value:", heapTypes[cheatTable[idx].heap].getter(cheatTable[idx].addr, module));
        if (newVal !== null) {
            let numVal = isNaN(newVal) ? newVal : Number(newVal);
            let heap = cheatTable[idx].heap;
            let addr = cheatTable[idx].addr;
            if (heap === 'HEAP8') module.HEAP8[addr] = numVal;
            else if (heap === 'HEAPU8') module.HEAPU8[addr] = numVal;
            else if (heap === 'HEAP16') module.HEAP16[addr/2] = numVal;
            else if (heap === 'HEAPU16') module.HEAPU16[addr/2] = numVal;
            else if (heap === 'HEAP32') module.HEAP32[addr/4] = numVal;
            else if (heap === 'HEAPU32') module.HEAPU32[addr/4] = numVal;
            else if (heap === 'HEAPF32') module.HEAPF32[addr/4] = numVal;
            else if (heap === 'HEAPF64') module.HEAPF64[addr/8] = numVal;
            renderTable();
        }
    };

    setInterval(() => {
        let module = getModule();
        if (!module) return;

        cheatTable.forEach(item => {
            if (item.frozen) {
                let heap = item.heap;
                let addr = item.addr;
                if (heap === 'HEAP8') module.HEAP8[addr] = item.value;
                else if (heap === 'HEAPU8') module.HEAPU8[addr] = item.value;
                else if (heap === 'HEAP16') module.HEAP16[addr/2] = item.value;
                else if (heap === 'HEAPU16') module.HEAPU16[addr/2] = item.value;
                else if (heap === 'HEAP32') module.HEAP32[addr/4] = item.value;
                else if (heap === 'HEAPU32') module.HEAPU32[addr/4] = item.value;
                else if (heap === 'HEAPF32') module.HEAPF32[addr/4] = item.value;
                else if (heap === 'HEAPF64') module.HEAPF64[addr/8] = item.value;
            }
        });
        if (cheatTable.length > 0) renderTable();
    }, 100);

    document.getElementById('ce-new-scan').onclick = () => {
        let searchVal = document.getElementById('ce-scan-val').value;
        if (searchVal === '') return;
        foundAddresses = scanHeap(searchVal);
        updateResults();
    };

    document.getElementById('ce-next-scan').onclick = () => {
        if (foundAddresses.length > 0) {
            let searchVal = document.getElementById('ce-scan-val').value;
            if (searchVal === '') return;
            foundAddresses = filterHeapScan(searchVal, foundAddresses);
            updateResults();
        }
    };

    document.getElementById('ce-heap-view').onchange = (e) => {
        currentHeapView = e.target.value;
    };

    let isDragging = false;
    let dragOffsetX, dragOffsetY;
    const header = container.querySelector('.ce-header');
    header.addEventListener('mousedown', (e) => {
        if (e.target.classList.contains('ce-collapse-btn')) return;
        isDragging = true;
        dragOffsetX = e.clientX - container.offsetLeft;
        dragOffsetY = e.clientY - container.offsetTop;
        container.style.position = 'fixed';
        container.style.margin = '0';
    });
    document.addEventListener('mousemove', (e) => {
        if (isDragging) {
            container.style.left = (e.clientX - dragOffsetX) + 'px';
            container.style.top = (e.clientY - dragOffsetY) + 'px';
            container.style.right = 'auto';
        }
    });
    document.addEventListener('mouseup', () => { isDragging = false; });

    const collapseBtn = container.querySelector('.ce-collapse-btn');
    const contentDiv = container.querySelector('.ce-content');
    collapseBtn.addEventListener('click', () => {
        if (contentDiv.style.display === 'none') {
            contentDiv.style.display = 'flex';
            collapseBtn.textContent = '_';
        } else {
            contentDiv.style.display = 'none';
            collapseBtn.textContent = '□';
        }
    });

    const inputField = document.getElementById('ce-scan-val');
    inputField.addEventListener('focus', () => { isInputActive = true; });
    inputField.addEventListener('blur', () => { isInputActive = false; });

    document.addEventListener('keydown', (event) => {
        if (!isInputActive) return;
        if (event.key === 'Escape') return;

        const input = document.getElementById('ce-scan-val');
        const start = input.selectionStart;
        const end = input.selectionEnd;
        let currentValue = input.value;

        if (event.key === 'Backspace') {
            event.preventDefault();
            if (start === end && start > 0) {
                input.value = currentValue.slice(0, start - 1) + currentValue.slice(end);
                input.setSelectionRange(start - 1, start - 1);
            } else if (start !== end) {
                input.value = currentValue.slice(0, start) + currentValue.slice(end);
                input.setSelectionRange(start, start);
            }
        } else if (event.key === 'Delete') {
            event.preventDefault();
            if (start === end && start < currentValue.length) {
                input.value = currentValue.slice(0, start) + currentValue.slice(start + 1);
                input.setSelectionRange(start, start);
            } else if (start !== end) {
                input.value = currentValue.slice(0, start) + currentValue.slice(end);
                input.setSelectionRange(start, start);
            }
        } else if (event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey) {
            event.preventDefault();
            input.value = currentValue.slice(0, start) + event.key + currentValue.slice(end);
            input.setSelectionRange(start + 1, start + 1);
        }

        input.dispatchEvent(new Event('input', { bubbles: true }));
    }, true);
})();