Donio
Banned User
Solved
Last edited:
local t = {
item = 8309,
itemPos = {x=100, y=100, z=7},
teleportFrom = {x=100, y=100, z=7},
teleportTo = {x=100, y=100, z=7}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = getTopCreature(t.teleportFrom).uid
if isPlayer(player) then
local thing = getTileItemById(t.itemPos, t.item).uid
if thing ~= 0 then
doRemoveItem(thing)
doTeleportThing(player, t.teleportTo)
doSendMagicEffect(t.teleportFrom, CONST_ME_TELEPORT)
doSendMagicEffect(t.teleportTo, CONST_ME_TELEPORT)
else
doPlayerSendCancel(cid, 'You must place the item on the coal basin.')
end
else
doPlayerSendCancel(cid, 'You must stand on to switch.')
end
return true
end
local coal = {x=EDIT, y=EDIT, z=EDIT, stackpos = 1}
local playerpos = {x=EDIT, y=EDFIT, z=EDIT, stackpos = 253}
local coal1 = getThingfromPos(coal)
local playerpos1 = getThingfromPos(playerpos)
itemID = xxxx
function onUse(cid, item, fromPosition, itemEx, toPosition)
if playerpos1.itemid > 0 then
if coal1.itemid == itemID then
doTeleportThing(cid,playerpos2)
doRemoveItem(coal1.uid)
else
doPlayerSendCancel(cid,"You must place the correct item in the coal basin")
end
else
doPlayerSendCancel(cid, "You are not in the right position")
end
return true
end
local items = {
{8302, {x=1113, y=1556, z=11}},
{8303, {x=1117, y=1556, z=11}}
}
local players = {
{{x=1114, y=1557, z=11}, {x=1115, y=1541, z=11}},
{{x=1116, y=1557, z=11}, {x=1117, y=1541, z=11}},
{{x=1113, y=1559, z=11}, {x=1115, y=1542, z=11}},
{{x=1117, y=1559, z=11}, {x=1117, y=1542, z=11}},
{{x=1113, y=1561, z=11}, {x=1115, y=1543, z=11}},
{{x=1117, y=1561, z=11}, {x=1117, y=1543, z=11}}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local t = {}
for i = 1, #players do
t[i] = getTopCreature(players[i][1]).uid
if not isPlayer(t[i]) then
return doPlayerSendCancel(cid, 'All ' .. #players .. ' players need to stand on their tiles.')
end
end
local it = {}
for i = 1, #items do
it[i] = getTileItemById(items[i][2], items[i][1]).uid
if it[i] == 0 then
return doPlayerSendCancel(cid, 'You must place the correct items on coal basins.')
end
end
for i = 1, #t do
doTeleportThing(t[i], players[i][2])
doSendMagicEffect(players[i][1], CONST_ME_TELEPORT)
doSendMagicEffect(players[i][2], CONST_ME_TELEPORT)
end
for i = 1, #it do
doRemoveItem(it[i])
end
return true
end