Cavegame Join Notification

Notify when someone joins Cavegame with a blue box message

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Cavegame Join Notification
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Notify when someone joins Cavegame with a blue box message
// @author       DevzGod
// @match        *://cavegame.io/*
// @grant        Heath
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to create a notification box
    function createNotification(message) {
        // Create the notification container
        const notification = document.createElement('div');
        notification.style.position = 'fixed';
        notification.style.bottom = '20px';
        notification.style.right = '20px';
        notification.style.backgroundColor = 'rgba(0, 0, 255, 0.8)'; // Blue color
        notification.style.color = 'white';
        notification.style.padding = '10px 20px';
        notification.style.borderRadius = '5px';
        notification.style.fontFamily = 'Arial, sans-serif';
        notification.style.zIndex = '9999';
        notification.style.boxShadow = '0 2px 10px rgba(0, 0, 0, 0.5)';
        notification.textContent = message;

        // Append to the body
        document.body.appendChild(notification);

        // Remove after 5 seconds
        setTimeout(() => {
            notification.remove();
        }, 5000);
    }

    // Simulate a join event (you'll need to hook into the game's API or WebSocket for real events)
    function simulateJoinEvent(playerName) {
        createNotification(`${playerName} have Loged into CaveHAX by Dev`);
    }

    // Example: Simulate someone joining after 2 seconds
    setTimeout(() => {
        simulateJoinEvent('You');
    }, 2000);

    // Hook into the game's actual events if possible
    // For example, if the game has a WebSocket connection:
    /*
    const socket = new WebSocket('wss://example-game-socket');
    socket.addEventListener('message', (event) => {
        const data = JSON.parse(event.data);
        if (data.type === 'playerJoin') {
            createNotification(`${data.playerName} has joined the game!`);
        }
    });
    */
})();