Nút ON/OFF dynamite (chỉ client-side, dễ bị ban)
// ==UserScript==
// @name Minefun.io SkyWars Infinite Dynamite Button
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Nút ON/OFF dynamite (chỉ client-side, dễ bị ban)
// @author You
// @match https://minefun.io/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
let enabled = false;
let dynamiteInterval = null;
// Tạo nút ON/OFF đẹp hơn, di chuyển được, resize được
const btn = document.createElement('button');
btn.innerText = 'DYNAMITE OFF';
btn.style.position = 'fixed';
btn.style.zIndex = '999999';
btn.style.left = '20px';
btn.style.top = '100px';
btn.style.padding = '12px 20px';
btn.style.fontSize = '18px';
btn.style.fontWeight = 'bold';
btn.style.color = 'white';
btn.style.background = 'linear-gradient(145deg, #ff4444, #cc0000)';
btn.style.border = '3px solid #880000';
btn.style.borderRadius = '12px';
btn.style.cursor = 'move';
btn.style.boxShadow = '0 6px 15px rgba(0,0,0,0.6)';
btn.style.transition = 'all 0.2s';
btn.style.userSelect = 'none';
document.body.appendChild(btn);
// Hiệu ứng 3D nhẹ khi hover
btn.onmouseover = () => {
btn.style.transform = 'scale(1.08) translateY(-3px)';
btn.style.boxShadow = '0 10px 25px rgba(0,0,0,0.7)';
};
btn.onmouseout = () => {
btn.style.transform = 'scale(1)';
btn.style.boxShadow = '0 6px 15px rgba(0,0,0,0.6)';
};
// Di chuyển nút bằng chuột
let isDragging = false;
let currentX, currentY, initialX, initialY;
btn.addEventListener('mousedown', (e) => {
if (e.button === 0) { // chuột trái
isDragging = true;
initialX = e.clientX - currentX;
initialY = e.clientY - currentY;
btn.style.cursor = 'grabbing';
}
});
document.addEventListener('mousemove', (e) => {
if (isDragging) {
e.preventDefault();
currentX = e.clientX - initialX;
currentY = e.clientY - initialY;
btn.style.left = currentX + 'px';
btn.style.top = currentY + 'px';
}
});
document.addEventListener('mouseup', () => {
isDragging = false;
btn.style.cursor = 'move';
});
// Resize bằng +/- (focus nút rồi bấm phím)
document.addEventListener('keydown', (e) => {
if (document.activeElement === btn || e.target === document.body) {
let size = parseInt(btn.style.fontSize) || 18;
if (e.key === '+') {
size += 3;
btn.style.fontSize = size + 'px';
btn.style.padding = (size/1.5) + 'px ' + (size*1.1) + 'px';
} else if (e.key === '-') {
size = Math.max(12, size - 3);
btn.style.fontSize = size + 'px';
btn.style.padding = (size/1.5) + 'px ' + (size*1.1) + 'px';
}
}
});
// Toggle ON/OFF
btn.onclick = () => {
enabled = !enabled;
btn.innerText = enabled ? 'DYNAMITE ON (999+)' : 'DYNAMITE OFF';
btn.style.background = enabled ? 'linear-gradient(145deg, #44ff44, #00cc00)' : 'linear-gradient(145deg, #ff4444, #cc0000)';
btn.style.borderColor = enabled ? '#008800' : '#880000';
if (enabled) {
alert("Bật infinite dynamite client-side.\nCảnh báo: Dễ bị ban khi server check!");
// Logic fake infinite (ví dụ: spam add dynamite vào hotbar mỗi 300ms)
dynamiteInterval = setInterval(() => {
try {
// Cách này chỉ là ví dụ – bạn cần tìm đúng object/item trong window/game
// Thường là window.gameScene hoặc window.player.inventory...
// Đây là phần khó nhất và hay thay đổi
if (window.game && window.game.player) {
let inv = window.game.player.inventory;
if (inv) {
// Tìm slot dynamite (thay bằng tên thật: 'dynamite' hoặc 'tnt' hoặc mã item)
for (let i = 0; i < 9; i++) { // hotbar
if (!inv.slots[i] || inv.slots[i].id === 'dynamite' || inv.slots[i].name?.includes('TNT')) {
inv.slots[i] = {id: 'dynamite', count: 999999};
inv.update(); // giả sử có hàm update
break;
}
}
}
}
} catch(e) {}
}, 300);
} else {
clearInterval(dynamiteInterval);
}
};
console.log("Nút dynamite đã tạo. Kéo để di chuyển, +/- để resize, click để bật/tắt.");
})();