Follow along with the video below to see how to install our site as a web app on your home screen.
Notka: This feature may not be available in some browsers.
local config =
{
[12000] =
{
items =
{
[2390] = {position = {x=1000, y=1000, z=7, stackpos=2}, count = 1},
[2160] = {position = {x=1001, y=1000, z=7, stackpos=1}, count = 100}
},
teleportPlace = {x=1100, y=1100, z=7},
effect = CONST_ME_MAGIC_BLUE,
message = {MESSAGE_INFO_DESCR, 'Zostales teleportowany do coffe shopu.'},
removeItems = true
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local teleport = config[item.actionid]
if(not teleport) then
return 0
end
local items = {}
for k, v in pairs(teleport.items) do
local thing = getThingfromPos(v.position)
if(thing.itemid ~= k or thing.type < v.count) then
doPlayerSendCancel(cid, 'Musisz polozyc w odpowiednie miejsce ' .. (v.count > 1 and v.count or '') .. ' "' .. getItemIdByName(k) .. '".')
return 1
end
table.insert(items, {uid = thing.uid, count = v.count})
end
doSendMagicEffect(getCreaturePosition(cid), teleport.effect)
doTeleportThing(cid, teleport.teleportPlace)
doSendMagicEffect(teleport.teleportPlace, teleport.effect)
if(teleport.removeItems) then
for _, v in pairs(items) do
doSendMagicEffect(getThingPos(v.uid), teleport.effect)
doRemoveItem(v.uid, v.count)
end
end
doPlayerSendTextMessage(cid, teleport.message[1], teleport.message[2])
return 1
end
doPlayerAddItem(cid,v.uid, v.count)
doRemoveItem(getitem.uid)
doPlayerAddItem(cid,v.uid, v.count)
doTeleportThing(cid, teleport.teleportPlace)
doPlayerAddItem(cid,1.uid, 1.count)