Ev.IO AimBot

farts

// ==UserScript==
// @name         Ev.IO AimBot
// @namespace    http://tampermonkey.net/
// @version      0.1
// @author       Bumpkin
// @match        *://ev.io/*
// @description  farts
// @icon         submaballs
// @grant        none
// ==/UserScript==

function showPopup(message) {
    var popupContainer = document.createElement('div')
    popupContainer.style.position = 'fixed'
    popupContainer.style.top = '0'
    popupContainer.style.left = '0'
    popupContainer.style.width = '100%'
    popupContainer.style.backgroundColor = '#1a1a1a'
    popupContainer.style.color = '#fff'
    popupContainer.style.padding = '10px'
    popupContainer.style.textAlign = 'center'
    popupContainer.style.zIndex = '9999'

    var textElement = document.createElement('div')
    textElement.innerHTML = message
    textElement.style.fontSize = '18px'
    textElement.style.color = '#fff'
    textElement.style.fontFamily = 'monospace !important';

    var buttonContainer = document.createElement('div');
    buttonContainer.style.display = 'inline-block';

    var closeButton = document.createElement('button');
    closeButton.innerHTML = '<b>Confirm</b>';
    closeButton.style.padding = '8px 14px';
    closeButton.style.backgroundColor = '#ff6600';
    closeButton.style.border = 'none';
    closeButton.style.borderRadius = '6px !important';
    closeButton.style.color = '#fff';
    closeButton.style.cursor = 'pointer';
    closeButton.style.marginLeft = '10px';
    closeButton.style.fontFamily = 'monospace !important';

    closeButton.addEventListener('click', function() {
        document.body.removeChild(popupContainer);
    });

    popupContainer.appendChild(textElement);
    popupContainer.appendChild(buttonContainer);
    popupContainer.appendChild(closeButton);

    document.body.appendChild(popupContainer);
}

const prototype_ = {
    ESP: {
        nameTags: true,
        msg: "See More Options On The Experimental Tab"
    },
    aimbot: {
        enabled: true,
        offsetY: 1.5,
        smoothing: 0.8,
        msg: "See More Options On The Experimental Tab"
    },
    lights: {
        msg: "Modifying These Settings May Not Be Changed Back Till Reload",
        intensityDirect: 0.3,
        intensityHemi: 0.6
    },
    experimental:{
        wireframe: true,
        AutoShootOnDist: false,
        AutoMinDist: 20
    }

}
let Scene

let players = []
let TP
let Camera
const sens = 500
const game = document.getElementById( 'canvas' )
const originalWeakMapGet = WeakMap.prototype.get
const CustomSceneColor = new THREE.Color(prototype_.lights.customColor)
function ShootHold(bool) {

    const type = bool ? 'mousedown' : 'mouseup';
    game.dispatchEvent( new MouseEvent( type, { button: 2 } ) );
    game.dispatchEvent( new MouseEvent( type, { button: 0 } ) );

}
if(prototype_.experimental.AutoShootOnDist)setInterval(()=>ShootHold(false), 900)
function HFO(){
    for(const child of Scene.children){
        if(child.type === "PerspectiveCamera"){
            Camera = child
        }
        if (child.type === 'Sprite') {

            if (child.material.map.image.className.includes('healthbar')) {
                child.material.depthTest = prototype_.ESP.nameTags ? false : true
                child.material.depthWrite = true
                players.push(child)

            }

        }else if(child.type === "Group"){
            if(child.children.length === 1){
                try{
                    for(const byteGroup of child.children[0].children){
                        if(byteGroup.type !== "Mesh")continue
                        for(const material of byteGroup.material){
                            material.wireframe = prototype_.experimental.wireframe
                        }
                    }
                }catch{}
            }
        }else if(child.type === "DirectionalLight"){
            child.intensity = prototype_.lights.intensityDirect
        }else if(child.type === "HemisphereLight"){
            child.intensity = prototype_.lights.intensityHemi
        }
    }
    let SkoonDist = Infinity
    let dist
    for (const player of players) {
        try{
            dist = player.position.distanceTo(Camera.position)
            if ( dist < SkoonDist ) {
                TP = player
                SkoonDist = dist
            }
        }catch{}

    }
    if(TP && TP.visible && prototype_.aimbot.enabled){
        const OriginalY = Camera.rotation.y
        const OriginalX = Camera.rotation.x
        Camera.rotation.order = 'YXZ';
        const targetPosition = new THREE.Vector3(TP.position.x, TP.position.y - prototype_.aimbot.offsetY, TP.position.z)
        const targetRotation = new THREE.Quaternion().setFromRotationMatrix(
            new THREE.Matrix4().lookAt(Camera.position, targetPosition, Camera.up)
        );
        Camera.quaternion.slerp(targetRotation, prototype_.aimbot.smoothing);

        game.dispatchEvent( new MouseEvent( 'mousemove', {
            movementX: ( OriginalY - Camera.rotation.y ) * sens,
            movementY: ( OriginalX - Camera.rotation.x ) * sens
        }))
        if(TP && prototype_.experimental.AutoShootOnDist){
            dist = TP.position.distanceTo(Camera.position)
            if(dist < prototype_.experimental.AutoMinDist){
                ShootHold(true)
            }else{
                ShootHold(false)
            }
        }
    }

    players.length = 0

}

WeakMap.prototype.get = function(key) {
    const value = originalWeakMapGet.call(this, key)
    if (key && key.type === "Scene" && key.children instanceof Array && key.children.length > 4) {
        Scene = key

        HFO()
    }
    return value
};



const style = document.createElement('style');
style.innerHTML = `
/* Dark theme styling */
*{
    font-family: monospace !important;
}
#menuContainer * {
    color: #ffffff !important;
    font-family: monospace;
}

#menuContainer {
    background-color: #1a1a1a !important;
    font-family: monospace;
    margin: 0 !important;
    padding: 0 !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    padding: 20px !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    z-index: 1000 !important;
    width: 345px !important;
}

.menuHeaderText1 {
    font-size: 20px !important;
    text-align: center !important;
    width: 170px !important;
    margin-top: 15px;

}

.menuItemTitle1 {
    font-size: 18px !important;
    animation: rgbAnimation 0.5s infinite alternate !important;
}

@keyframes rgbAnimation {
    0% { color: rgb(255, 0, 0) !important; }
    25% { color: rgb(255, 255, 0) !important; }
    50% { color: rgb(0, 255, 0) !important; }
    75% { color: rgb(0, 255, 255) !important; }
    100% { color: rgb(255, 0, 255) !important; }
}

.tab {
    gap: 1.3px !important;
display: flex !important;
    justify-content: space-around !important;
    margin-bottom: 20px !important;
}

.tab button {
    background-color: transparent !important;
    border: none !important;
    padding: 8px 12px !important;
    font-weight: 400 !important;
    outline: none !important;
    color: #ffffff !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.tab button:hover,
.tab button.active {
    background-color: rgba(255, 255, 255, 0.2) !important;
    border-radius: 5px !important;
}

.tabcontent {
    display: none !important;
    margin-top: 20px !important;
}

.tabcontent.active {
    display: block !important;
}

.dropdown-toggle {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: #1f1f1f !important;
    color: #ffffff !important;
    border: none !important;
    margin-top: -5px !important;
    border-radius: 5px !important;
    padding: 10px !important;
    cursor: pointer !important;
    font-size: 13px !important;
}

.dropdown-toggle:hover {
    background-color: #333 !important;
}

.dropdown-toggle:focus {
    outline: none !important;
}

.slider-container {
    display: flex !important;
    align-items: center !important;
    margin-top: -5px !important;
}

.slider-container input[type=range] {
    flex: 1 !important;
    -webkit-appearance: none !important;
    background-color: #ff6600 !important;
    height: 2px !important;
    margin-right: 10px !important;
}

.slider-container input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    background-color: #ffffff !important;
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
}

.slider-container input[type=range]::-webkit-slider-thumb:hover {
    background-color: #ff6600 !important;
}

.slider-container input[type=range]::-moz-range-thumb {
    background-color: #ffffff !important;
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
}

.slider-container input[type=range]::-moz-range-thumb:hover {
    background-color: #ff6600 !important;
}

.slider-container label {
    margin-right: 10px !important;
}

@keyframes slideInFromBottom {
    0% {
        transform: translateY(10%) !important;
        opacity: 0 !important;
    }
    100% {
        transform: translateY(0) !important;
        opacity: 1 !important;
    }
}

.menuButton {
    background-color: #ff6600 !important;
    border: none !important;
    color: white !important;
    padding: 10px 20px !important;
    text-align: center !important;
    text-decoration: none !important;
    display: inline-block !important;
    font-size: 16px !important;
    margin: 10px 2px !important;
    cursor: pointer !important;
    border-radius: 5px !important;
    position: absolute !important;
    bottom: 10px !important;
    right: 10px !important;
}

button:focus, button:active {
    outline: none !important;
    border: none !important;
}
`;

document.head.appendChild(style);

function openMenu() {
    const menuContainer = document.createElement('div');
    menuContainer.id = 'menuContainer';
    menuContainer.style.display = 'none';
    menuContainer.innerHTML = `
        <div class="tab">
            <button class="tablinks active" onclick="openTab(event, 'ESP')">ESP</button>
            <button class="tablinks" onclick="openTab(event, 'Aimbot')">Aimbot</button>
            <button class="tablinks" onclick="openTab(event, 'Lights')">Lights</button>
            <button class="tablinks" onclick="openTab(event, 'Experimental')">Experimental</button>
        </div>
        <div id="ESP" class="tabcontent active">
            <div class="menuHeaderText1">NameTags ESP</div>
            <label class="menuItemTitle1">
                <input type="checkbox" id="nameTagsCheckbox" ${prototype_.ESP.nameTags ? 'checked' : ''}> NameTags ESP
            </label>
            <div class="menuHeaderText1">${prototype_.ESP.msg}</div>
        </div>
        <div id="Aimbot" class="tabcontent">
            <div class="menuHeaderText1">Aimbot Settings</div>
            <label class="menuItemTitle1">
                <input type="checkbox" id="aimbotCheckbox" ${prototype_.aimbot.enabled ? 'checked' : ''}> Enable Aimbot
            </label>
            <div class="slider-container">
                <label for="offsetYSlider">Offset Y:</label>
                <input type="range" id="offsetYSlider" min="0" max="5" step="0.1" value="${prototype_.aimbot.offsetY}">
            </div>
            <div class="slider-container">
                <label for="smoothingSlider">Smoothing:</label>
                <input type="range" id="smoothingSlider" min="0" max="1" step="0.01" value="${prototype_.aimbot.smoothing}">
            </div>
            <div class="menuHeaderText1">${prototype_.aimbot.msg}</div>
        </div>
        <div id="Lights" class="tabcontent">
            <div class="menuHeaderText1">Light Settings</div>
            <div class="slider-container">
                <label for="intensityDirectSlider">Direct Light Intensity:</label>
                <input type="range" id="intensityDirectSlider" min="0" max="1" step="0.01" value="${prototype_.lights.intensityDirect}">
            </div>
            <div class="slider-container">
                <label for="intensityHemiSlider">Hemi Light Intensity:</label>
                <input type="range" id="intensityHemiSlider" min="0" max="1" step="0.01" value="${prototype_.lights.intensityHemi}">
            </div>
            <div class="menuHeaderText1">${prototype_.lights.msg}</div>
        </div>
        <div id="Experimental" class="tabcontent">
            <div class="menuHeaderText1">Experimental Settings</div>
            <label class="menuItemTitle1">
                <input type="checkbox" id="wireframeCheckbox" ${prototype_.experimental.wireframe ? 'checked' : ''}> Wireframe
            </label>
            <label class="menuItemTitle1">
                <input type="checkbox" id="AutoShootOnDistCheckbox" ${prototype_.experimental.AutoShootOnDist ? 'checked' : ''}> Auto Shoot On Distance
            </label>
            <div class="slider-container">
                <label for="AutoMinDistSlider">Auto Min Distance:</label>
                <input type="range" id="AutoMinDistSlider" min="0" max="100" step="1" value="${prototype_.experimental.AutoMinDist}">
            </div>
        </div>
        <button class="menuButton" onclick="closeMenu()">Close</button>
    `;
    document.body.appendChild(menuContainer);
    menuContainer.style.display = 'block';

    document.getElementById('nameTagsCheckbox').addEventListener('change', function() {
        prototype_.ESP.nameTags = this.checked;
    });

    document.getElementById('aimbotCheckbox').addEventListener('change', function() {
        prototype_.aimbot.enabled = this.checked;
    });

    document.getElementById('offsetYSlider').addEventListener('input', function() {
        prototype_.aimbot.offsetY = parseFloat(this.value);
    });

    document.getElementById('smoothingSlider').addEventListener('input', function() {
        prototype_.aimbot.smoothing = parseFloat(this.value);
    });

    document.getElementById('intensityDirectSlider').addEventListener('input', function() {
        prototype_.lights.intensityDirect = parseFloat(this.value);
    });

    document.getElementById('intensityHemiSlider').addEventListener('input', function() {
        prototype_.lights.intensityHemi = parseFloat(this.value);
    });

    document.getElementById('wireframeCheckbox').addEventListener('change', function() {
        prototype_.experimental.wireframe = this.checked;
    });

    document.getElementById('AutoShootOnDistCheckbox').addEventListener('change', function() {
        prototype_.experimental.AutoShootOnDist = this.checked;
    });

    document.getElementById('AutoMinDistSlider').addEventListener('input', function() {
        prototype_.experimental.AutoMinDist = parseFloat(this.value);
    });
}

function closeMenu() {
    const menuContainer = document.getElementById('menuContainer');
    if (menuContainer) {
        menuContainer.remove();
    }
}

function openTab(evt, tabName) {
    const tabcontent = document.getElementsByClassName('tabcontent');
    for (let i = 0; i < tabcontent.length; i++) {
        tabcontent[i].style.display = 'none';
        tabcontent[i].classList.remove('active');
    }

    const tablinks = document.getElementsByClassName('tablinks');
    for (let i = 0; i < tablinks.length; i++) {
        tablinks[i].classList.remove('active');
    }

    document.getElementById(tabName).style.display = 'block';
    document.getElementById(tabName).classList.add('active');
    evt.currentTarget.classList.add('active');
}

const menuButton = document.createElement('button');
menuButton.innerHTML = '<b>Menu</b>';
menuButton.className = 'menuButton';
menuButton.addEventListener('click', openMenu);
document.body.appendChild(menuButton);

showPopup('The Script Is Now Working!');