Niko 👨‍💻 💀

Niko'ya Özel Hız (K), Fly (L) ve Menü İçin Kar Yağma Efekti

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Niko 👨‍💻 💀
// @namespace    http://tampermonkey.net/
// @version      22.0
// @description  Niko'ya Özel Hız (K), Fly (L) ve Menü İçin Kar Yağma Efekti
// @author       Niko & [EZ7]
// @match        https://tribals.io/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    let currentSpeed = 5.0, hileAktif = false;
    let flyAktif = false, flySensitivity = 0.18, flyY = null;
    let menuVisible = true, isDragging = false, offsetX, offsetY;
    const keys = {};

    // --- 1. ZAMAN MANİPÜLASYONU (Speed Hack Core) ---
    const originalNow = performance.now.bind(performance);
    const originalDateNow = Date.now;
    let fakeTime = originalNow(), lastUpdate = originalNow();

    performance.now = function() {
        const now = originalNow();
        const delta = now - lastUpdate;
        fakeTime += delta * (hileAktif ? currentSpeed : 1.0);
        lastUpdate = now;
        return fakeTime;
    };

    Date.now = function() { return originalDateNow() + (performance.now() - originalNow()); };

    // --- 2. KAR YAĞMA EFEKTİ SİSTEMİ ---
    function startSnowing(canvas) {
        const ctx = canvas.getContext('2d');
        const flakes = [];
        function createFlake() {
            return {
                x: Math.random() * canvas.width,
                y: Math.random() * canvas.height,
                s: Math.random() * 2 + 1,
                v: Math.random() * 1 + 0.5
            };
        }
        for(let i = 0; i < 50; i++) flakes.push(createFlake());

        function draw() {
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            ctx.fillStyle = "rgba(255, 215, 0, 0.6)";
            flakes.forEach(f => {
                ctx.beginPath();
                ctx.arc(f.x, f.y, f.s, 0, Math.PI * 2);
                ctx.fill();
                f.y += f.v;
                if (f.y > canvas.height) { f.y = -5; f.x = Math.random() * canvas.width; }
            });
            requestAnimationFrame(draw);
        }
        draw();
    }

    // --- 3. MENÜ TASARIMI ---
    function createMenu() {
        const menu = document.createElement("div");
        menu.id = "niko-chaos-menu";
        menu.innerHTML = `
            <canvas id="niko-snow-canvas" style="position:absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; border-radius:15px; z-index:0;"></canvas>
            <div id="niko-header" style="position:relative; z-index:1;">NİKO 👨‍💻 💀 VIP MENU ❄️ 👑</div>
            <div class="niko-content" style="position:relative; z-index:1;">
                <div class="niko-status-box" id="speed-status">SPEED: KAPALI</div>
                <div class="niko-status-box" id="fly-status" style="margin-top:5px; color:#00e5ff; border-color:#00e5ff;">FLY: KAPALI</div>

                <div class="niko-slider-section" style="margin-top:15px;">
                    <div class="niko-label-row"><span>HIZ AYARI:</span><span id="niko-speed-display">5.0x</span></div>
                    <input type="range" id="niko-speed-slider" min="1" max="5" step="0.1" value="5">
                </div>

                <div class="niko-slider-section" style="margin-top:10px;">
                    <div class="niko-label-row"><span>FLY HASSASİYETİ:</span><span id="niko-fly-display">0.18</span></div>
                    <input type="range" id="niko-fly-slider" min="0.05" max="0.8" step="0.01" value="0.18">
                </div>

                <button id="niko-toggle-btn" style="margin-top:15px;">SPEED AKTİFLEŞTİR (K)</button>
                <button id="niko-fly-btn" style="margin-top:8px; border-color:#00e5ff; color:#00e5ff;">FLY AKTİFLEŞTİR (L)</button>

                <div class="niko-divider"></div>
                <div class="niko-info">
                    • <b>U-J:</b> Yükseklik | <b>Shift:</b> Boost<br>
                    • <b>Kısayol:</b> Speed(K) | Fly(L) | Menü(O)
                </div>
            </div>
        `;

        const style = document.createElement("style");
        style.innerHTML = `
            #niko-chaos-menu {
                position: fixed; top: 50px; left: 50px; width: 280px;
                background: rgba(15, 0, 25, 0.95); border: 2px solid #FFD700;
                border-radius: 15px; color: #fff; font-family: 'Segoe UI', sans-serif;
                z-index: 1000000; box-shadow: 0 0 30px rgba(255, 215, 0, 0.4); overflow: hidden;
            }
            #niko-header { background: linear-gradient(90deg, #b8860b, #FFD700); color: #000; padding: 14px; font-weight: 900; text-align: center; cursor: move; font-size: 13px; }
            .niko-content { padding: 20px; }
            .niko-status-box { text-align: center; padding: 10px; background: rgba(0,0,0,0.6); border-radius: 8px; font-weight: bold; color: #ff3333; font-size: 11px; border: 1px solid #444; }
            .niko-label-row { display: flex; justify-content: space-between; font-size: 11px; font-weight: bold; margin-bottom: 5px; color: #FFD700; }
            input[type=range] { width: 100%; accent-color: #FFD700; cursor: pointer; }
            button { width: 100%; padding: 12px; background: rgba(0,0,0,0.7); border: 1px solid #FFD700; color: #FFD700; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 11px; transition: 0.2s; }
            button:hover { background: #FFD700; color: #000; }
            .niko-divider { height: 1px; background: #444; margin: 15px 0; }
            .niko-info { font-size: 11px; color: #ccc; line-height: 1.4; }
        `;
        document.head.appendChild(style);
        document.body.appendChild(menu);

        const cvs = menu.querySelector("#niko-snow-canvas");
        cvs.width = 280; cvs.height = 450;
        startSnowing(cvs);

        // Slider Kontrolleri
        menu.querySelector("#niko-speed-slider").addEventListener("input", (e) => {
            currentSpeed = parseFloat(e.target.value);
            menu.querySelector("#niko-speed-display").innerText = currentSpeed.toFixed(1) + "x";
        });

        menu.querySelector("#niko-fly-slider").addEventListener("input", (e) => {
            flySensitivity = parseFloat(e.target.value);
            menu.querySelector("#niko-fly-display").innerText = flySensitivity;
        });

        window.toggleSpeed = function() {
            hileAktif = !hileAktif;
            const sStatus = document.getElementById("speed-status");
            if (sStatus) {
                sStatus.innerText = hileAktif ? `SPEED: AKTİF (${currentSpeed}x)` : "SPEED: KAPALI";
                sStatus.style.color = hileAktif ? "#00ff88" : "#ff3333";
            }
            if (window.pc?.app) window.pc.app.timeScale = hileAktif ? currentSpeed : 1.0;
        };

        window.toggleFly = function() {
            flyAktif = !flyAktif;
            const fStatus = document.getElementById("fly-status");
            if (fStatus) {
                fStatus.innerText = flyAktif ? "FLY: AKTİF 🚀" : "FLY: KAPALI";
                fStatus.style.color = flyAktif ? "#00e5ff" : "#ff3333";
            }
            if (flyAktif) {
                const p = window.tribals?.localPlayer?.entity;
                if (p) flyY = p.getPosition().y;
            }
        };

        menu.querySelector("#niko-toggle-btn").onclick = window.toggleSpeed;
        menu.querySelector("#niko-fly-btn").onclick = window.toggleFly;

        // Sürükleme Mantığı
        menu.querySelector("#niko-header").onmousedown = (e) => {
            isDragging = true;
            offsetX = e.clientX - menu.offsetLeft;
            offsetY = e.clientY - menu.offsetTop;
        };
        document.addEventListener('mousemove', (e) => {
            if (isDragging) {
                menu.style.left = (e.clientX - offsetX) + "px";
                menu.style.top = (e.clientY - offsetY) + "px";
            }
        });
        document.addEventListener('mouseup', () => isDragging = false);
    }

    // --- 4. ANA DÖNGÜ (Fly Smooth Bypass) ---
    function loop() {
        if (flyAktif) {
            const player = window.tribals?.localPlayer?.entity;
            if (player?.position) {
                let moveSpeed = flySensitivity;
                if (keys['ShiftLeft']) moveSpeed *= 2.5;

                const pos = player.getPosition();
                let nx = pos.x, ny = flyY, nz = pos.z;

                if (keys['KeyW']) nz -= moveSpeed;
                if (keys['KeyS']) nz += moveSpeed;
                if (keys['KeyA']) nx -= moveSpeed;
                if (keys['KeyD']) nx += moveSpeed;
                if (keys['KeyU']) flyY += 0.3;
                if (keys['KeyJ']) flyY -= 0.3;

                if (player.setMovementTeleport) {
                    player.setMovementTeleport(nx, flyY, nz);
                } else {
                    player.setPosition(nx, flyY, nz);
                }
            }
        }
        requestAnimationFrame(loop);
    }

    // --- 5. KLAVYE DİNLEYİCİSİ ---
    window.addEventListener("keydown", (e) => {
        keys[e.code] = true;
        if (document.activeElement.tagName === "INPUT" || document.activeElement.tagName === "TEXTAREA") return;

        if (e.key.toLowerCase() === "k") window.toggleSpeed();
        if (e.key.toLowerCase() === "l") window.toggleFly();
        if (e.key.toLowerCase() === "o") {
            menuVisible = !menuVisible;
            document.getElementById("niko-chaos-menu").style.display = menuVisible ? "block" : "none";
        }
    });
    window.addEventListener("keyup", (e) => { keys[e.code] = false; });

    window.addEventListener("load", () => { createMenu(); loop(); });

    // PlayCanvas Engine Hook
    window._pc = false;
    Object.defineProperty(window, "pc", { set(v) { if (!window._pc) window._pc = v; }, get() { return window._pc; } });
})();