Update CUnleash.js

This commit is contained in:
David Duran Rosich
2026-05-28 23:59:49 +02:00
parent c00aa75bc4
commit a57f932d64

View File

@@ -25,12 +25,11 @@ setInterval(function () {
(function () { (function () {
"use strict"; "use strict";
let state = true; let state = false;
let intervalId; let intervalId;
document.addEventListener("keydown", function (event) { document.addEventListener("keydown", function (event) {
if (event.code === "KeyX") { if (event.code === "KeyX") {
state = !state; // toggle state
if (state) { if (state) {
// code to run when state is ON // code to run when state is ON
console.log("State is ON"); console.log("State is ON");
@@ -49,21 +48,23 @@ setInterval(function () {
intervalId = setInterval(function () { intervalId = setInterval(function () {
Game.ClickCookie(); Game.ClickCookie();
}, 4); }, 4);
state = true;
} }
function stopAutoClicker() { function stopAutoClicker() {
console.log("Auto-clicker stopped"); console.log("Auto-clicker stopped");
Game.Notify(`Auto clicker OFF`, `Press X to toggle`, [0, 35], false); Game.Notify(`Auto clicker OFF`, `Press X to toggle`, [0, 35], false);
clearInterval(intervalId); clearInterval(intervalId);
state = false;
} }
// Wait for the Game object to be defined, then start the auto-clicker // Wait for the Game object to be defined, then start the auto-clicker
const waitIntervalId = setInterval(function () { // const waitIntervalId = setInterval(function () {
if (typeof Game !== "undefined") { // if (typeof Game !== "undefined") {
clearInterval(waitIntervalId); // clearInterval(waitIntervalId);
stopAutoClicker(); // stopAutoClicker();
} // }
}, 1000); // }, 1000);
})(); })();
// setInterval(function() { // setInterval(function() {