#Anti .tp

1 messages · Page 1 of 1 (latest)

uncut cypress
#

I have this code but when they die and respawn it kicks them

system.runInterval(() => {
  for (const player of world.getPlayers()) {
      const prevX = player.getDynamicProperty('prevX');
      const prevY = player.getDynamicProperty('prevY');
      const prevZ = player.getDynamicProperty('prevZ');

      const currentX = Math.floor(player.location.x);
      const currentY = Math.floor(player.location.y);
      const currentZ = Math.floor(player.location.z);
      if (prevX !== undefined && prevY !== undefined && prevZ !== undefined) {
          const distance = Math.sqrt(Math.pow(currentX - prevX, 2) + Math.pow(currentY - prevY, 2) + Math.pow(currentZ - prevZ, 2));
          if (distance > 30 && !player.hasTag(`TP`)) {
            world.sendMessage(`§c${player.name} §7has been flagged for Movement Hacks.`)
            world.getDimension(`overworld`).runCommandAsync(`kick "${player.name}" §ckicked for Hacks.`)
            world.getAllPlayers().forEach((plr) => plr.playSound(`note.bass`), {pitch: 0.8})
          }
      }

      player.setDynamicProperty('prevX', currentX);
      player.setDynamicProperty('prevY', currentY);
      player.setDynamicProperty('prevZ', currentZ);
  }
}, 2);
marsh wyvern
#

does it work in detecting the "movement hacks" before at least?

lusty gorge
final quest
uncut cypress
#

Sry for not asking you

final quest
uncut cypress
final quest
uncut cypress
#

Is there a fix?

final quest
uncut cypress
#

Like event?

final quest
#

Not sure if it's after or before events

uncut cypress
#

Ill use TP tag as I use it for all tps

#

but smart

uncut cypress
#

would be good for hardcore

final quest
#

Then just if (distance > 30 && !player.hasTag('spawn'))

uncut cypress
#

true

#

Ok ty

#

Ill try it later with a friend

final quest
# uncut cypress true
world.afterEvents.playerSpawn.subscribe(ev => {
   ev.player.addTag('spawn');
   if (ev.player.hasTag('spawn')) {
      system.runTimeout(() => {
         ev.player.removeTag('spawn');
      }, 2);
   }
});```