View difference between Paste ID: fHHM651Q and BJ7Mzh7V
SHOW: | | - or go back to the newest paste.
1
local config = {
2
storage = 15529,
3
entry =
4
	{
5
		{x = 247, y = 659, z = 13},
6
		{x = 247, y = 660, z = 13},
7
		{x = 247, y = 660, z = 13},
8
	},
9-
	destination =
9+
destination =
10
	{
11
		{x = 189, y = 650, z = 13},
12
		{x = 189, y = 651, z = 13},
13
		{x = 189, y = 651, z = 13},
14
	}
15
}
16
17
function onUse(cid, item, fromPosition, itemEx, toPosition)
18
	local players = {}
19
	for _, position in ipairs(config.entry) do
20
		local pid = getTopCreature(position).uid
21
		if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
22
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
23
			return true
24
		end
25
26
		table.insert(players, pid)
27
	end
28
29
	for i, pid in ipairs(players) do
30
		doSendMagicEffect(config.entry[i], CONST_ME_POFF)
31
		doTeleportThing(pid, config.destination[i], false)
32
		doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
33
	end
34
35
	doTransformItem(item.uid, item.itemid + 1)
36
	return true
37
end