Smash Karts Infinite Minigun Ammo

Attempts to give infinite minigun bullets in Smash Karts

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
})();