nabbynz

Show "Save Attempt" Message In Game

Apr 29th, 2015
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name            Show "Save Attempt" Message In Game
  3. // @description     Shows "Save Attempt" on the scoreboard & and above the game (looks for "This is a save attempt!" in the chat from a system message)
  4. // @version         0.1.1
  5. // @include         http://tagpro-*.koalabeast.com:*
  6. // @include         http://*.jukejuice.com:*
  7. // @include         http://*.newcompte.fr:*
  8. // @license         none
  9. // @author          nabby
  10. // ==/UserScript==
  11.  
  12. tagpro.ready(function() {
  13.     var SaveAttemptMessage = 'This game is a save attempt!';
  14.    
  15.     function addSaveAttemptMessage() {
  16.         $('#mapInfo').after('<div id="addSaveAttemptMessage" style="font-size:16px;font-weight:bold; color:#f00; text-align:center; text-shadow:1px 2px 1px #222; clear:both">' + SaveAttemptMessage + '</div>');
  17.         $('body').prepend('<div id="addSaveAttemptMessage" style="margin:20px auto; font-size:16px;font-weight:bold; color:#f00; text-align:center; text-shadow:1px 2px 1px #222; clear:both">' + SaveAttemptMessage + '</div>');
  18.     }
  19.  
  20.     tagpro.socket.on('chat', function(data) {
  21.         if (data.from == null) { //system message
  22.             if (data.message.indexOf('This is a save attempt!') >= 0) {
  23.                 addSaveAttemptMessage();
  24.                 //alert(SaveAttemptMessage); //uncomment if you want a popup to also appear (good for testing)
  25.             }
  26.         }
  27.     });
  28. });
Advertisement
Add Comment
Please, Sign In to add comment