local pos = {x=33262, y=31835, z=12}
local level = 80
local soul = 100
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (isInArray({0, 65535}, toPosition.x) == FALSE and getTilePzInfo(toPosition) == TRUE) or getTilePzInfo(getThingPos(cid)) == TRUE then
doPlayerSendCancel(cid, 'You cannot use this item inside a protection zone.')
elseif getPlayerSoul(cid) < soul then
doPlayerSendCancel(cid, 'You need ' .. soul .. ' soul points to use this item.')
elseif isPlayer(itemEx.uid) ~= TRUE then
doPlayerSendCancel(cid, 'You can only use this rune on players.')
elseif itemEx.uid == cid then
doPlayerSendCancel(cid, 'You cannot use this rune on yourself.')
elseif getPlayerLevel(cid) < level then
doPlayerSendCancel(cid, 'You need level ' .. level .. ' to use this rune.')
elseif getPlayerLevel(itemEx.uid) >= level then
doPlayerSendCancel(cid, 'You can only use this rune on players of level lower than ' .. level .. '.')
else
doPlayerAddSoul(cid, -soul)
doTeleportThing(itemEx.uid, pos)
doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
doChangeTypeItem(item.uid, item.type - 1)
return TRUE, doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have teleported ' .. getCreatureName(itemEx.uid) .. '.')
end
return TRUE, doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end