local scroll = 1949 --paper itemid
local places = {
['trainers'] = {x=95,y=117,z=7},
['temple'] = {x=200,y=100,z=7},
}
function onTextEdit(cid, item, newText)
if item.itemid ~= scroll or getPlayerItemById(cid, true, scroll).uid ~= item.uid then
return true
end
if isPlayerPzLocked(cid) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_PLAYERISPZLOCKED)
return true
end
if isInArray({'locations','location','place','places'},newText:lower()) then
local i = ''
for j, k in pairs(places) do
i = i .. ' [' .. j .. ']'
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can only write these locations to teleport: ' .. i)
return true
end
if not places[newText:lower()] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Invalid location, write "locations" for more info.')
return true
end
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doTeleportThing(cid, places[newText:lower()])
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
return true
end