teleport_to_creature.lua

main 31 lines · 712 bytes Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1function onSay(player, words, param)
2 local split = param:splitTrimmed(",")
3 if player:getGroup():getId() < 3 then
4 return false
5 end
6
7 if tonumber(split[01]) then
8 local pos_1 = tonumber(split[01])
9 local pos_2 = tonumber(split[02])
10 local pos_3 = tonumber(split[03])
11 local pos_goTo = {x=pos_1, y=pos_2, z=pos_3}
12 local isGhost = not player:isInGhostMode()
13
14 if isGhost then
15 player:teleportTo(pos_goTo)
16 player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
17 else
18 player:teleportTo(pos_goTo)
19 end
20 return false
21 end
22
23 local target = Creature(param)
24 if target then
25 player:teleportTo(target:getPosition())
26 else
27 player:sendCancelMessage("Creature not found.")
28 end
29 return false
30end
31
Top