[Help] Porting Core.
Unsolved
Support
-
Can someone help me convert CzechHek's antibot script from Core to the Script Api 2 version?
I'm an idiot, so if anyone would be kind enough to help me out.
///api_version=2 (script = registerScript({ name: "MatrixAntiBot", authors: ["CzechHek"], version: "3.5" })).import("Core.lib"); module = { category: "Combat", onPacket: function (e) { if (e.getPacket().wrapped instanceof S41PacketServerDifficulty) wasAdded = false; if (mc.thePlayer && e.getPacket().wrapped instanceof S38PacketPlayerListItem && e.getPacket().wrapped.getAction() == "ADD_PLAYER") { name = (info = e.getPacket().wrapped.getEntries().get(0)).getProfile().getName(); if (!wasAdded) wasAdded = name == mc.thePlayer.getName(); else if (!mc.thePlayer.isSpectator() && !mc.thePlayer.capabilities.allowFlying && info.getPing() && info.getGameMode() != "NOT_SET") e.cancelEvent(), print("§2§lRemoved a bot§a:", name); } } } var wasAdded;
^This is for liquidbounce B73, and I want to use it on a custom build (liquiddrip)
-
here is it
var scriptName = "MatrixAntiBot"; var scriptAuthor = "CzechHek"; var scriptVersion = 3.5; var S38PacketPlayerListItem = Java.type("net.minecraft.network.play.server.S38PacketPlayerListItem"); var S41PacketServerDifficulty = Java.type("net.minecraft.network.play.server.S41PacketServerDifficulty"); var wasAdded; function MatrixAntiBot() { this.getName = function() { return "MatrixAntiBot"; }; this.getDescription = function() { return "antibot (matrix proof)"; }; this.getCategory = function() { return "Combat"; }; this.onPacket = function(e) { if (e.getPacket() instanceof S41PacketServerDifficulty) wasAdded = false; if (e.getPacket() instanceof S38PacketPlayerListItem && e.getPacket().getAction() == "ADD_PLAYER") { var info = e.getPacket().getEntries().get(0); var name = info.getProfile().getName(); if (!wasAdded) { wasAdded = name != mc.thePlayer.getName(); } else if (mc.thePlayer && !mc.thePlayer.isSpectator() && !mc.thePlayer.capabilities.allowFlying && info.getPing() && info.getGameMode() != "NOT_SET") { chat.print("Removed a bot"); e.cancelEvent(); } } } } var matrixantibot = new MatrixAntiBot(); function onEnable() { moduleManager.registerModule(matrixantibot); }; function onDisable() { moduleManager.unregisterModule(matrixantibot); };
it seems to be working but not sure
it's a 5-months old script it's probs patched tho -
@nvinci said in [Help] Porting Core.:
here is it
if (!wasAdded) { wasAdded = name != mc.thePlayer.getName();
@omnomnom said in [Help] Porting Core.:
if (!wasAdded) wasAdded = name == mc.thePlayer.getName();
-
@czechhek Oh so do I just replace that, and this is what it should be, right?
if (!wasAdded) wasAdded = name == mc.thePlayer.getName(); else if (mc.thePlayer && !mc.thePlayer.isSpectator() && !mc.thePlayer.capabilities.allowFlying && info.getPing() && info.getGameMode() != "NOT_SET") { chat.print("§2§lRemoved a Matrix bot§a"); e.cancelEvent();