// ==UserScript== // @name hammer senpa io mod // @namespace http://tampermonkey.net/ // @version 1.1 // @description Optimize Senpa.io for better performance, freeze on death, and visual enhancements with a unified GUI // @author hammer // @match https://senpa.io/* // @grant GM_addStyle // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Create the GUI container for toggle const guiContainer = document.createElement('div'); guiContainer.id = 'fps-booster-gui'; guiContainer.style.position = 'fixed'; guiContainer.style.bottom = '20px'; guiContainer.style.left = '20px'; guiContainer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)'; guiContainer.style.color = 'white'; guiContainer.style.padding = '10px'; guiContainer.style.borderRadius = '5px'; guiContainer.style.zIndex = '9999'; guiContainer.style.fontFamily = 'Arial, sans-serif'; const toggleBtn = document.createElement('button'); toggleBtn.innerText = 'FPS Optimization: ON'; toggleBtn.style.backgroundColor = '#28a745'; toggleBtn.style.color = 'white'; toggleBtn.style.border = 'none'; toggleBtn.style.padding = '10px'; toggleBtn.style.borderRadius = '5px'; toggleBtn.style.cursor = 'pointer'; guiContainer.appendChild(toggleBtn); document.body.appendChild(guiContainer); let optimizationEnabled = true; let fxOn = true; let isFrozen = false; // Toggle FPS Optimization On/Off toggleBtn.addEventListener('click', () => { optimizationEnabled = !optimizationEnabled; if (optimizationEnabled) { toggleBtn.innerText = 'FPS Optimization: ON'; toggleBtn.style.backgroundColor = '#28a745'; enableOptimization(); } else { toggleBtn.innerText = 'FPS Optimization: OFF'; toggleBtn.style.backgroundColor = '#dc3545'; disableOptimization(); } }); // Toggle visual effects (brightness/contrast) const toggleFxBtn = document.createElement('button'); toggleFxBtn.innerText = "Toggle FX"; toggleFxBtn.style.position = "absolute"; toggleFxBtn.style.top = "10px"; toggleFxBtn.style.right = "10px"; toggleFxBtn.style.zIndex = "9999"; toggleFxBtn.style.padding = "5px 10px"; toggleFxBtn.style.fontSize = "14px"; toggleFxBtn.style.background = "#222"; toggleFxBtn.style.color = "#fff"; toggleFxBtn.style.border = "1px solid #555"; toggleFxBtn.style.borderRadius = "5px"; document.body.appendChild(toggleFxBtn); toggleFxBtn.onclick = () => { const canvas = document.querySelector("canvas"); fxOn = !fxOn; if (canvas) { if (fxOn) { canvas.style.filter = "brightness(1.05) contrast(1.15) saturate(1.05)"; } else { canvas.style.filter = "none"; } } }; // Function to enable FPS optimization function enableOptimization() { // Remove animations, background images, and unnecessary scripts document.body.style.backgroundImage = 'none'; const images = document.querySelectorAll('img'); images.forEach(img => { img.src = ''; // Remove image sources }); const style = document.createElement('style'); style.innerHTML = ` * { animation: none !important; transition: none !important; box-shadow: none !important; } canvas { image-rendering: optimizeSpeed; will-change: transform; } `; document.head.appendChild(style); // Disable background music or sounds const audios = document.querySelectorAll('audio'); audios.forEach(audio => { audio.pause(); }); // Remove unnecessary elements like ads and popups const ads = document.querySelectorAll('.ad, .sidebar, .popup'); ads.forEach(ad => ad.remove()); // Also, remove extra UI elements that may be heavy (optional) const uiElements = document.querySelectorAll('.extra-ui, .notifications'); uiElements.forEach(element => element.remove()); } // Function to disable FPS optimization function disableOptimization() { // Re-enable animations and background images const style = document.createElement('style'); style.innerHTML = ` * { animation: initial !important; transition: initial !important; } `; document.head.appendChild(style); } // Freeze the player on death function freezeOnDeath() { if (isFrozen) return; // Don't apply freezing multiple times const player = document.querySelector('.player'); // Adjust selector as necessary if (!player) return; // Ensure player element exists // This part freezes player by disabling movement (we simulate it by preventing controls) isFrozen = true; // Disable controls by modifying any game state variables related to movement document.addEventListener('keydown', preventMovement); document.addEventListener('mousemove', preventMovement); document.addEventListener('mousedown', preventMovement); // Reset after a reasonable delay or when respawn happens setTimeout(() => { isFrozen = false; document.removeEventListener('keydown', preventMovement); document.removeEventListener('mousemove', preventMovement); document.removeEventListener('mousedown', preventMovement); }, 3000); // Adjust time as needed before allowing respawn } // Prevent movement if frozen function preventMovement(event) { event.preventDefault(); event.stopPropagation(); } // Polling for death state (or detect using specific game events) setInterval(() => { const deathState = document.querySelector('.dead'); // Update selector based on game's death state if (deathState && !isFrozen) { freezeOnDeath(); // Trigger freeze when dead } }, 1000); // Check every second for death state // Initialize FPS optimization and other features if (optimizationEnabled) { enableOptimization(); } })();