local Locations =
{
["temple"] = {1000, 1000, 7},
["depot"] = {447, 447, 7},
["ass"] = {454, 654, 6}
}
local noobConfig =
{
timeToRemove = 10, --in seconds
manaReq = 500,
soulReq = 10,
levelReq = 70
}
local function doRemoveTeleport(x)
doRemoveItem(getThingFromPos(x.p).uid)
end
local function LookPos(cid)
local pos = getCreaturePosition(cid)
local nPos = {
[0]={x=pos.x, y=pos.y-1, z=pos.z},
[1]={x=pos.x+1, y=pos.y, z=pos.z},
[2]={x=pos.x, y=pos.y+1, z=pos.z},
[3]={x=pos.x-1, y=pos.y, z=pos.z}}
return nPos[getPlayerLookDir(cid)]
end
function onSay(cid, words, param)
local STOP = FALSE
local toPosition = Locations[param]
if toPosition then
if getPlayerLevel(cid) >= noobConfig.levelReq then
if getCreatureMana(cid) >= noobConfig.manaReq then
if getPlayerSoul(cid) >= noobConfig.soulReq then
if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
local fromPosition = LookPos(cid)
fromPosition.stackpos = 1
local i = getThingFromPos(fromPosition)
if i.itemid > 0 then
if hasProperty(i.uid, CONST_PROP_BLOCKPATHFIND) == TRUE then
STOP = TRUE
end
end
if STOP == FALSE then
doCreateTeleport(1387, {x=toPosition[1], y=toPosition[2], z=toPosition[3]}, fromPosition)
doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
addEvent(doRemoveTeleport, 1000 * noobConfig.timeToRemove, {p = fromPosition})
else
doPlayerSendTextMessage(cid, 22, "BLAH BLAH BLAH A ITEM BLOCK WAY.")
end
else
doPlayerSendTextMessage(cid, 22, "BLAH BLAH YOU IN FIGHT.")
end
else
doPlayerSendTextMessage(cid, 22, "You need " .. noobConfig.soulReq .. " soul points to create a teleport.")
end
else
doPlayerSendTextMessage(cid, 22, "You need " .. noobConfig.manaReq .. " mana points to create a teleport.")
end
else
doPlayerSendTextMessage(cid, 22, "You need level " .. noobConfig.levelReq .. " to create a teleport.")
end
else
doPlayerSendTextMessage(cid, 22, "BLAH BLAH BLAH NOT CORRECT PARAM.")
end
return TRUE
end