Untitled
unknown
lua
a year ago
1.6 kB
5
Indexable
local config = { min_players = 2, positions = { entrance = { [1] = Position(0, 0, 0), [2] = Position(0, 0, 0), [3] = Position(0, 0, 0), [4] = Position(0, 0, 0) }, destination = { [1] = Position(0, 0, 0), [2] = Position(0, 0, 0), [3] = Position(0, 0, 0), [4] = Position(0, 0, 0) } } } function onUse(cid, item, fromPosition, itemEx, toPosition) local players = {} local isUserInsideTiles = false for i = 1, #config.positions.entrance do local position = config.positions.entrance[i] local creature = getTopCreature(position).uid if isPlayer(creature) then players[#players + 1] = { cid = creature, destination = config.positions.destination[i] } if creature == cid then isUserInsideTiles = true end end end if not isUserInsideTiles then return doPlayerSendCancel(cid, "You must be inside the tiles to use this lever.") end if #players < config.min_players then return doSendMagicEffect(getThingPos(item.uid), CONST_ME_POFF) end for i = 1, #players do local player = players[i].cid local destination = players[i].destination doSendMagicEffect(getThingPos(player), CONST_ME_TELEPORT) doTeleportThing(player, destination) doSendMagicEffect(getThingPos(player), CONST_ME_TELEPORT) end return true end
Editor is loading...
Leave a Comment