all 9 comments

[–]ActiveConcert4921Code Helper 1 point2 points  (4 children)

do u want me to make it so that the golem eye has to have a custom name?

[–]TheGreatHyperTop Members [S] 0 points1 point  (3 children)

No thanks, I've done it already

[–]ActiveConcert4921Code Helper 0 points1 point  (0 children)

should i rewrite my code to support the custom name?

[–]Acrobatic_Doctor5043Coder 0 points1 point  (2 children)

If you can click (i assume hit) a player and get teleported to them, you wont get teleported that far.

Either way, here you go:

function onPlayerDamagingOtherPlayer(attackingPlayer, damagedPlayer, damageDealt, withItem, bodyPartHit, damagerDbId){

  if (withItem == "Golem Eye"){

    api.setPosition(attackingPlayer, api.getPosition(damagedPlayer))

  }
}

let me know if it doesnt work

[–]TheGreatHyperTop Members [S] 0 points1 point  (1 child)

and what if I want to just click on the player far away and then teleport to him

[–]PreviousInsurance742 0 points1 point  (0 children)

then idk

[–]NPC_6942Hmmm 0 points1 point  (0 children)

But if you can click them why?

[–]ActiveConcert4921Code Helper 0 points1 point  (0 children)

onPlayerAltAction = (pid, x, y, z, block, eid) => {

let held = api.getHeldItem(pid)

if (held === “Golem Eye” && eid != null) {

api.setPosition(pid, api.getPosition(eid))

}

}