C PZ

Auto click faucet buttons with random delays, stealth mode, and guaranteed 1 minute refresh cycle.

// ==UserScript==
// @name         C PZ
// @namespace    https://coinpayz.xyz/
// @version      1.5
// @description  Auto click faucet buttons with random delays, stealth mode, and guaranteed 1 minute refresh cycle.
// @author       👽
// @match        https://coinpayz.xyz/faucet
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Helper: random delay between min and max (ms)
    function randomDelay(minSec, maxSec) {
        return (Math.random() * (maxSec - minSec) + minSec) * 1000;
    }

    // Try clicking element safely
    function safeClick(el) {
        if (!el) return false;
        try {
            el.click();
            return true;
        } catch {
            return false;
        }
    }

    // Wait for the CLAIM button to be enabled (poll every 1s)
    function waitForClaimButtonReady(timeoutMs = 60000) {
        return new Promise((resolve, reject) => {
            const start = Date.now();
            const interval = setInterval(() => {
                const claimBtn = document.querySelector('button#claim-faucet');
                if (claimBtn && !claimBtn.disabled) {
                    clearInterval(interval);
                    resolve(claimBtn);
                } else if (Date.now() - start > timeoutMs) {
                    clearInterval(interval);
                    reject();
                }
            }, 1000);
        });
    }

    async function run() {
        try {
            const collectBtn = document.querySelector('button[data-toggle="modal"][data-target="#claimModal"]');
            if (collectBtn) {
                // Random delay 9-13 seconds before clicking Collect button
                await new Promise(r => setTimeout(r, randomDelay(9, 13)));
                safeClick(collectBtn);

                // Wait for claim button to be enabled
                const claimBtn = await waitForClaimButtonReady();

                // Random delay 3-8 seconds before clicking Claim button
                await new Promise(r => setTimeout(r, randomDelay(3, 8)));
                safeClick(claimBtn);
            }
        } catch {
            // silently fail
        } finally {
            // Always wait 1 minute and then refresh
            setTimeout(() => {
                window.location.reload();
            }, 60000);
        }
    }

    window.addEventListener('load', () => {
        setTimeout(run, 3000);
    });
})();