Untitled a guest Feb 10th, 2017 125 Never a guest125Never

Not a member of Pastebin yet? Sign Up , it unlocks many cool features!

rawdownloadcloneembedreportprint JavaScript 1.25 KB // ==UserScript== // @name TagPro Server Count // @version 0 // @description The 2nd best userscript to ever grace the TagPro community. // @include http://*.koalabeast.com:* // @author Zagd // ==/UserScript== //README //Sends an in-game message with server player/game count information, when someone (including yourself) send '!sc' into the game chat. tagpro. ready ( function ( ) { server = window. location . href . substring ( window. location . href . indexOf ( 'tagpro-' ) + 7 , window. location . href . indexOf ( '.koalabeast.com' ) ) ; $. ajax ( { url : "http://tagpro-" + server + ".koalabeast.com/stats" , type : "get" , dataType : "jsonp" , success : function ( stats ) { console. log ( "message formed!" ) ; theMessage = "On " + server. charAt ( 0 ) . toUpperCase ( ) + server. slice ( 1 ) + ", there are currently " + stats [ "players" ] + " players in " + stats [ "games" ] + " games." ; } } ) ; tagpro. socket . on ( 'chat' , function ( data ) { console. log ( "message received" ) ; if ( data. message == "!sc" ) { console. log ( "!sc, sending " + theMessage ) ; setTimeout ( function ( ) { tagpro. socket . emit ( "chat" , { message : theMessage , toAll : true } ) ; } , 750 ) ; } } ) ; } ) ;

RAW Paste Data

// ==UserScript== // @name TagPro Server Count // @version 0 // @description The 2nd best userscript to ever grace the TagPro community. // @include http://*.koalabeast.com:* // @author Zagd // ==/UserScript== //README //Sends an in-game message with server player/game count information, when someone (including yourself) send '!sc' into the game chat. tagpro.ready(function() { server = window.location.href.substring(window.location.href.indexOf('tagpro-')+7, window.location.href.indexOf('.koalabeast.com')); $.ajax({ url: "http://tagpro-" + server + ".koalabeast.com/stats", type: "get", dataType: "jsonp", success: function(stats) { console.log("message formed!"); theMessage = "On " + server.charAt(0).toUpperCase() + server.slice(1) + ", there are currently " + stats["players"] + " players in " + stats["games"] + " games."; } }); tagpro.socket.on('chat', function(data) { console.log("message received"); if (data.message == "!sc") { console.log("!sc, sending " + theMessage); setTimeout(function(){tagpro.socket.emit("chat",{message:theMessage,toAll:true});}, 750); } }); });