Smash Karts Infinite Minigun Ammo

Attempts to give infinite minigun bullets in Smash Karts

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Smash Karts Infinite Minigun Ammo
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Attempts to give infinite minigun bullets in Smash Karts
// @author       You
// @match        *://smashkarts.io/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Wait for the game to load
    const interval = setInterval(() => {
        let game = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
        if (!game) return;

        try {
            for (const r of Object.values(game.renderers)) {
                for (const [id, inst] of r.findFiberRoots(1).entries()) {
                    let props = inst.current.memoizedProps;
                    if (props && props.children && props.children.props && props.children.props.kart) {
                        const kart = props.children.props.kart;
                        // Overwrite minigun data
                        setInterval(() => {
                            if (kart.weapon && kart.weapon.ammo !== Infinity) {
                                kart.weapon.ammo = Infinity;
                            }
                        }, 100);
                        clearInterval(interval);
                        console.log('[Tampermonkey] Infinite ammo script injected.');
                        return;
                    }
                }
            }
        } catch (e) {
            console.warn('Smash Karts script waiting:', e);
        }
    }, 1000);
})();