-- ver. 1 2011-11-30
-- author tfs, otland.net/members/andypsylon
local c = {
["bla1"] = {x = 651, y = 659, z = 7},
["bla2"] = {x = 659, y = 651, z = 7},
["bla3"] = {x = 655, y = 655, z = 7},
["bla4"] = {x = 654, y = 654, z = 7}
}
local itemek = 8266
function onSay(cid, words, param, channel)
if(not getTileInfo(getThingPosition(cid)).protection) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action (no pz).") and true
end
local pos = {x = 0, y = 0, z = 0}
if(param ~= '') then
pos = c[param:lower()]
else
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") and true
end
if getPlayerItemCount(cid, itemek) < 1 then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action (no item).") and true
end
if(not pos or isInArray({pos.x, pos.y}, 0)) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.") and true
end
pos = getClosestFreeTile(cid, pos, true)
if(not pos or isInArray({pos.x, pos.y}, 0)) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.") and true
end
local tmp = getThingPosition(cid)
if(doTeleportThing(cid, pos, true) and not isPlayerGhost(cid)) then
doSendMagicEffect(tmp, CONST_ME_POFF)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
end
return true
end