Clan Notification System


  • Corleone Staff Forum Admin

    Hello,

    Below is the script I've made for the clan notification system inside the Midnight base

    Serverside

    function onClientClicked(pl, obj, data, msg) {
        if (player.clanname === "") return;
        if (obj !== "Command") return;
        
        let message = "Quickly!";
        switch (data) {
            case "Alone": {
                message = "I'm all alone, need backup now!";
                break;
            }
            case "Flag": {
                message = "get to the flag, now!";
                break;
            }        
            case "Rally": {
                message = "Meet at me, let's rally up!";
                break;
            }                
            case "Help": {
                message = "Help quick! They're here";
                break;
            }     
            case "Custom": {
                message = msg;
                break;
            }          
        }
        let arr = Server.searchPlayers({clanname:pl.clanname});
        for (let i=0; i < arr.length; i++) {
            arr[i].showmessage("<b><font color="lightgreen">" + pl.name + "</font></b>: " + message);
        }
    }  
    

    Clientside

    function onMouseDown() {
            //The different pages and their HTMLs
        CLANMANAGEMENT_PAGES = {
            MAIN:       {value: 0, 
                        header:  "Clan Management",
                        text:   '<font size="4.5">Quick Clan Commands<br></br>' +
                                '<hr></hr>' +
                                '< input id="Command_Help" type="submit" class="button" style="left:0px;top:50px;width:125px;height:40px;background-color:lightgreen;" value="Call Help!">' +
                                '< input id="Command_Alone" type="submit" class="button" style="left:140px;top:50px;width:125px;height:40px;" value="I am alone!">' +
                                '< input id="Command_Flag" type="submit" class="button" style="left:0px;top:100px;width:125px;height:40px;" value="To the flag!">' +
                                '< input id="Command_Rally" type="submit" class="button" style="left:140px;top:100px;width:125px;height:40px;" value="Rally Up!">' +
                                '< input id="Command_Custom" type="text" style="position:absolute;left:0px;top:150px;width:255px;height:35px;font-size:12px;" value="">' +
                                '< input id="Command_Send" type="submit" class="button" style="left:80px;top:200px;width:125px;height:40px;" value="Send">'                             
                        }              
        };
    
        
            //Create the first GUI
        this.onLoadGUI(CLANMANAGEMENT_PAGES.MAIN);
    }
    
    function onLoadFunctions() {
        self = this;
        
        GUI.onclick("Command_Help", function(event) {
            GUI.hidepopup();   
            self.triggerserver("clicked", "Command", "Help");        
        });
        GUI.onclick("Command_Alone", function(event) {
            GUI.hidepopup();   
            self.triggerserver("clicked", "Command", "Alone");        
        });    
        GUI.onclick("Command_Flag", function(event) {
            GUI.hidepopup();
            self.triggerserver("clicked", "Command", "Flag");        
        });
        GUI.onclick("Command_Rally", function(event) {
            GUI.hidepopup();   
            self.triggerserver("clicked", "Command", "Rally");        
        });     
        GUI.onclick("Command_Send", function(event) {
            let message = GUI.get("Command_Custom").value;
            if (message.length < 3 || message.length > 30) return;
            
            GUI.hidepopup();   
            self.triggerserver("clicked", "Command", "Custom", message);
        });     
    }
    
    function onLoadGUI(OBJ) {
        GUI_CLANMANAGEMENT = GUI.showpopup({
            title: OBJ.header,
            width: 210,
            height: 210
        });
        
        GUI_CLANMANAGEMENT.innerHTML = OBJ.text;
        this.onLoadFunctions();
    }
    

    I used the GUI system to create this found here.


  • Banned

    Awesome to see this added


  • Corleone Staff

    I Love that thing



  • Amazing! Great idea by @xii and great execution by flameboy!!!!



  • @xii Great idea, happy to see it added!



  • Awesome!



  • @flameboy The proposed system is very intriguing. I look forward to its implementation!


  • Corleone Staff

    @tikiman47 It has already been implemented in Midnight base.


Log in to reply