Hi
Well this script is nothing special, but I think it can be useful.
Description:
Look on the tile where you want to create a teleporter and say /addtp then go and look on the tile where it should lead to and say /addtp again. Now there will be a teleport on the first tile which leads to the second.
This is useful if you want to add a shortcut or found a teleporter which is not working or if you forgot to add a teleporter before the restart and don't want to restart again.
Note: If you made a mistake with the first position just say /addtp clear and then you can choose a new position.
Script:
data/talkactions/talkactions.xml:
data/talkactions/scripts/addtp.lua:
Well this script is nothing special, but I think it can be useful.
Description:
Look on the tile where you want to create a teleporter and say /addtp then go and look on the tile where it should lead to and say /addtp again. Now there will be a teleport on the first tile which leads to the second.
This is useful if you want to add a shortcut or found a teleporter which is not working or if you forgot to add a teleporter before the restart and don't want to restart again.
Note: If you made a mistake with the first position just say /addtp clear and then you can choose a new position.
Script:
data/talkactions/talkactions.xml:
Code:
<talkaction log="yes" words="/addtp" access="5" event="script" value="addtp.lua"/>
data/talkactions/scripts/addtp.lua:
Lua:
function comparePosition(pos1, pos2)
return (pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z) and true or false
end
local position = false
function onSay(cid, words, param, channel)
local pos,c = getCreatureLookPosition(cid),position
if param == "clear" then
position = false
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Clear.")
end
if not(position) or not(comparePosition(position,pos)) then
if position == false then
position = pos
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, string.format("The teleporter's position was set. [X: %i, Y: %i, Z: %i]",pos.x, pos.y, pos.z)) and doSendMagicEffect(pos, 14)
end
position = false
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, string.format("The teleporter was set up. From:[X: %i, Y: %i, Z: %i] To:[X: %i, Y: %i, Z: %i]",c.x, c.y, c.z, pos.x, pos.y, pos.z)) and doSendMagicEffect(pos, 14) and doCreateTeleport(1387, pos, c)
end
return doPlayerSendCancel(cid,"The teleport position can't be the position where the teleporter is.")
end