Created
August 10, 2025 12:51
-
-
Save blacksmithop/c69d01a72ce2bc27c3267c105a17053d to your computer and use it in GitHub Desktop.
Deobfuscated Grappling Hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let playerPosition, player, hookPosition, deltaX = 0, deltaY = 0, deltaZ = 0, timer = 0; | |
function onPlayerUsedThrowable(playerId, itemId, hookId) { | |
playerPosition = api.getPosition(playerId); | |
} | |
function onPlayerJoin(playerId) { | |
api.sendMessage(playerId, 'Welcome, this grappling hook code is made by x_Drxth'); | |
} | |
function onPlayerThrowableHitTerrain(playerId, itemId, hookId) { | |
player = playerId; | |
hookPosition = api.getPosition(hookId); | |
playerPosition = api.getPosition(playerId); | |
const hookX = Math.floor(hookPosition[0]); | |
const hookY = Math.floor(hookPosition[1]); | |
const hookZ = Math.floor(hookPosition[2]); | |
const playerX = Math.floor(playerPosition[0]); | |
const playerY = Math.floor(playerPosition[1]); | |
const playerZ = Math.floor(playerPosition[2]); | |
deltaX = hookX - playerX; | |
deltaY = hookY - playerY; | |
deltaZ = hookZ - playerZ; | |
} | |
function tick() { | |
timer++; | |
if (timer % 1 === 0) { | |
const currentPosition = api.getPosition(player); | |
if (currentPosition[0] !== hookPosition[0] || currentPosition[1] !== hookPosition[1] || currentPosition[2] !== hookPosition[2]) { | |
if (deltaX > 0 && deltaX > deltaX) { | |
deltaX += 1; | |
api.setPosition(player, playerPosition[0] + deltaX, playerPosition[1] + deltaY, playerPosition[2] + deltaZ); | |
} else if (deltaX < 0 && deltaX < deltaX) { | |
deltaX -= 1; | |
api.setPosition(player, playerPosition[0] + deltaX, playerPosition[1] + deltaY, playerPosition[2] + deltaZ); | |
} | |
if (deltaZ > 0 && deltaZ < deltaZ) { | |
deltaZ += 1; | |
api.setPosition(player, playerPosition[0] + deltaX, playerPosition[1] + deltaY, playerPosition[2] + deltaZ); | |
} else if (deltaZ < 0 && deltaZ > deltaZ) { | |
deltaZ -= 1; | |
api.setPosition(player, playerPosition[0] + deltaX, playerPosition[1] + deltaY, playerPosition[2] + deltaZ); | |
} | |
if (deltaY > 0 && deltaY < deltaY) { | |
deltaY += 1; | |
api.setPosition(player, playerPosition[0] + deltaX, playerPosition[1] + deltaY, playerPosition[2] + deltaZ); | |
} else if (deltaY < 0 && deltaY > deltaY) { | |
deltaY -= 1; | |
api.setPosition(player, playerPosition[0] + deltaX, playerPosition[1] + deltaY, playerPosition[2] + deltaZ); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment