Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name OLTP2_Jerseys_script
- // @namespace http://www.reddit.com/user/NewCompte
- // @description Rotating Transparent Jerseys on Radian's texture pack
- // @include http://*.koalabeast.com:*
- // @license GPL
- // @author NewCompte, modified by brioche
- // @version 1
- // ==/UserScript==
- // set team jersesy for the right color HERE
- blueTeamJerseyIndex = 5
- redTeamJerseyIndex = 5
- // This is for other jerseys than the first 2 ones
- blueTeamJerseyOption = 0
- redTeamJerseyOption = 0
- function myRotatingBallsScript() {
- tagpro.ready(function(){
- //This is important.
- if(tagpro.events.drawPlayer)
- return;
- // Test for oltp
- var jerseysOLTP = new Image();
- jerseysOLTP.src = "http://i.imgur.com/KLsr6JU.png";
- var BorderLight = new Image();
- BorderLight.src = "http://i.imgur.com/GZ6E6Sr.png";
- // Muscle cup texture pack:
- document.getElementById("tiles").src = "http://i.imgur.com/ggmGe81.png";
- document.getElementById("splats").src = "http://i.imgur.com/3m8yX7z.png";
- document.getElementById("speedpad").src = "http://i.imgur.com/M00rUPA.png";
- document.getElementById("speedpadred").src = "http://i.imgur.com/PgDCaGU.png";
- document.getElementById("speedpadblue").src = "http://i.imgur.com/1dgjMlf.png";
- document.getElementById("portal").src = "http://i.imgur.com/qDUaiqD.png";
- //Wait 1 second then redraw textures
- setTimeout(tagpro.api.redrawBackground,1000);
- if (tagpro.events.drawPlayer) {return;}
- tagpro.events.register({
- drawPlayer: function(player, context, drawPos, TILESIZE) {
- // Draw rotating jersey
- context.save();
- context.globalAlpha = 1; // Here is transparency
- context.translate(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom));
- context.rotate(player.angle);
- context.translate(-drawPos.x - (TILESIZE / 2) * (1 / tagpro.zoom), -drawPos.y - (TILESIZE / 2) * (1 / tagpro.zoom));
- if (player.team == 1)
- context.drawImage(jerseysOLTP, 80 + redTeamJerseyOption*80, redTeamJerseyIndex * 40, 40, 39, drawPos.x, drawPos.y, 40 / tagpro.zoom, 39 / tagpro.zoom);
- if (player.team == 2)
- context.drawImage(jerseysOLTP, 120 + blueTeamJerseyOption*80, blueTeamJerseyIndex * 40, 40, 39, drawPos.x, drawPos.y, 40 / tagpro.zoom, 39 / tagpro.zoom);
- context.restore();
- // Draw muscle cup border
- context.drawImage(BorderLight, 0, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
- // Draw pixel perfect rolling bomb
- if (player.bomb && Math.round(Math.random() * 4) == 1) {
- context.fillStyle = "rgba(255, 255, 0, .60)";
- context.beginPath();
- context.arc(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom), 17 * (1 / tagpro.zoom), 0, Math.PI*2, true);
- context.closePath();
- context.fill();
- };
- // Draw pixel perfect tagpro
- if (player.tagpro) {
- context.strokeStyle = "#00FF00";
- context.fillStyle = "rgba(0, 255, 0, .20)";
- context.lineWidth = 2 * (1 / tagpro.zoom);
- context.beginPath();
- context.arc(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom), 16 * (1 / tagpro.zoom), 0, Math.PI*2, true);
- context.closePath();
- if (!player.bomb)
- context.fill();
- context.stroke();
- }
- }
- });
- });
- }
- var source = "("+ myRotatingBallsScript + ")()";
- var script = document.createElement('script');
- script.setAttribute("type", "application/javascript");
- script.textContent = source;
- document.body.appendChild(script);
Add Comment
Please, Sign In to add comment