CCBlueX Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Give me script autodisable fly pls :(

    Scripts
    3
    3
    54
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • nam nguyen
      nam nguyen last edited by

      Re: AutoDisable

      G 1 Reply Last reply Reply Quote 0
      • G
        Gabriel @nam nguyen last edited by Gabriel

        @nam-nguyen

        var fadeTimer = 0;
        var reasons = ['Fly disabled due to server change.', 'Fly disabled due to you dying.'];
        var S06PacketUpdateHealth = Java.type('net.minecraft.network.play.server.S06PacketUpdateHealth');
        var ScaledResolution = Java.type('net.minecraft.client.gui.ScaledResolution');
        var Fly = moduleManager.getModule('Fly');
        function getScaledWidth() {
            var scaledWidth = new ScaledResolution(mc).getScaledWidth();
            return scaledWidth;
        }
        function getScaledHeight() {
            var scaledHeight = new ScaledResolution(mc).getScaledHeight();
            return scaledHeight;
        }
        var script = registerScript({
            name: 'AutoDisable',
            version: '0.0.0',
            authors: ['Shurpe']
        });
        script.registerModule({
            name: 'AutoDisable',
            description: 'Turns off the Fly module when needed',
            category: 'Fun'
        
        }, function (module) {
        	module.on('packet', function (e) {
        		var packet = e.getPacket();
                if (packet instanceof S06PacketUpdateHealth && packet.getHealth() <= 0 && Fly.getState()) {
                    Fly.setState(false); reason = reasons[1]; disabled = true;
                }
            });
        	module.on('update', function () {
                mcWidth = getScaledWidth(); mcHeight = getScaledHeight();
                disabled ? fadeTimer++ : fadeTimer = 0;
                if (fadeTimer >= 50) {
                    disabled = false;
                }
            });
            module.on('render2D', function () {
                if (disabled) {
                    mc.fontRendererObj.drawStringWithShadow(reason, mcWidth / 2 - mc.fontRendererObj.getStringWidth(reason) / 2, 15, 0xFFFFFF);
                    mc.fontRendererObj.drawStringWithShadow('§cWarning!', mcWidth / 2 - mc.fontRendererObj.getStringWidth('Warning!') / 2, 5, 0xFFFFFF);
                }
            });
            module.on('world', function () {
                if (Fly.getState()) {
                    reason = reasons[0]; Fly.setState(false); disabled = true;
                }
            });
        });
        
        1 Reply Last reply Reply Quote 0
        • A
          Aftery last edited by

          ltg.jpg

          1 Reply Last reply Reply Quote 0
          • Referenced by  G Gabriel 
          • First post
            Last post
          About
          • Terms of Service
          • Privacy Policy
          • Status
          • Contact Us
          Downloads
          • Releases
          • Source code
          • License
          Docs
          • Tutorials
          • CustomHUD
          • AutoSettings
          • ScriptAPI
          Community
          • Forum
          • Guilded
          • YouTube
          • Twitter
          • D.Tube