local lvl = 460
local t = {
{vocations = {1, 5},Pos = {{x=935, y=534, z=7},{x=947, y=530, z=7}},item= {2175,{x=935, y=535, z=7}}},
{vocations = {2, 6},Pos = {{x=941, y=534, z=7},{x=946, y=531, z=7}},item= {2674,{x=941, y=535, z=7}}},
{vocations = {3, 7},Pos = {{x=936, y=526, z=7},{x=946, y=530, z=7}},item= {2455,{x=936, y=525, z=7}}},
{vocations = {4, 8},Pos = {{x=942, y=526, z=7},{x=946, y=529, z=7}},item= {2376,{x=942, y=525, z=7}}}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local check = {}
local items = {}
for _, k in ipairs(t) do
local x = getTopCreature(k.Pos[1]).uid
local v = getTileItemById(k.item[2], k.item[1])
if(x == 0 or not isPlayer(x) or getPlayerLevel(x) < lvl or isInArray(k.vocations, getPlayerVocation(x)) == FALSE) then
doPlayerSendCancel(cid, 'Player is missing or someone does not have level or or has no vocation.') return true
elseif v.uid == 0 then
doPlayerSendCancel(cid, "All Items Must Be In The Table.") return true end
table.insert(check, x)
table.insert(items, v)
end
for k, tid in ipairs(check) do
doSendMagicEffect(getCreaturePosition(tid), CONST_ME_POFF)
doTeleportThing(tid, t[k].Pos[2])
doSendMagicEffect(getCreaturePosition(tid), CONST_ME_TELEPORT)
end
for _, remove in ipairs(items) do
doRemoveItem(remove.uid)
end
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
return true
end